Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the overlapping of labels and values for pie charts #99

Open
fusheng-fate opened this issue May 11, 2023 · 5 comments
Open

the overlapping of labels and values for pie charts #99

fusheng-fate opened this issue May 11, 2023 · 5 comments

Comments

@fusheng-fate
Copy link

how to deal with the overlapping of labels and values for pie charts? Can I set the percentage accuracy of the label?

@AlexNosk
Copy link

@fusheng-fate Could you please attach your source and output documents here for testing? We will check the issue and provide you more information.

PS: the main place for getting support is Aspose.Words support forum. It is better to post the questions there to get faster reply.

@fusheng-fate
Copy link
Author

fusheng-fate commented May 15, 2023

@Test
public void testas() throws Exception {

    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    // Insert a chart shape with a document builder and get its chart.
    Shape chartShape = builder.insertChart(ChartType.PIE, 432, 256);
    Chart chart = chartShape.getChart();
    chart.getSeries().clear();
    chart.getSeries().add("Aspose Test Series",
            new String[]{"Word", "PDF", "Excel", "GoogleDocs", "Note"},
            new double[]{500.0, 1.0, 1.0, 2.0, 2.0});

    ChartDataLabelCollection dataLabels = chart.getSeries().get(0).getDataLabels();
    for (int i = 0; i < 5 ; i++) {
        dataLabels.add(i).setShowLeaderLines(true);
        dataLabels.get(i).setShowPercentage(true);
        dataLabels.get(i).setShowValue(true);
        dataLabels.get(i).getNumberFormat().setFormatCode("0.00%");
        dataLabels.get(i).setShowDataLabelsRange(true);
    }
    // Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
    ChartTitle title = chart.getTitle();
    title.setText("My Chart");
    // Set the "Show" property to "true" to make the title visible.
    title.setShow(true);
    // Set the "Overlay" property to "true" Give other chart elements more room by allowing them to overlap the title
    title.setOverlay(false);
    doc.save("d:/" + "Charts.ChartTitle.docx");
}

aspose_pie

@fusheng-fate
Copy link
Author

@AlexNosk Thank you for your reply. This is my test code. I have found a corresponding API to handle the issue of setting percentage accuracy, but the issue of overlapping labels cannot be resolved.

@AlexNosk
Copy link

@fusheng-fate Unfortunately, currently there is no way to specify position of data labels. This feature request is logged as WORDSNET-21965. We will keep you updated and let you know once it is resolved.

@fusheng-fate
Copy link
Author

@AlexNosk Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants