We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove legend entry from chart series

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

        // Add chart with default data.
        Shape shape = builder.InsertChart(ChartType.Doughnut, 432, 252);
        Chart chart = shape.Chart;
        chart.Title.Text = "Data Labels With Different Number Format";
       

        // Delete default generated series.
        chart.Series.Clear();

        // Add new series
        ChartSeries series0 = chart.Series.Add("AW Series 0", new string[] { "AW0", "AW1", "AW2" }, new double[] { 2.5, 1.5, 3.5 });

        // Add DataLabel to the first point of the first series.
        ChartDataLabel chartDataLabel0 = series0.DataLabels.Add(0);
        chartDataLabel0.ShowValue = true;

        // Set currency format code.
        chartDataLabel0.NumberFormat.FormatCode = "\"$\"#,##0.00";

        ChartDataLabel chartDataLabel1 = series0.DataLabels.Add(1);
        chartDataLabel1.ShowValue = true;

        // Set date format code.
        chartDataLabel1.NumberFormat.FormatCode = "d/mm/yyyy";

        ChartDataLabel chartDataLabel2 = series0.DataLabels.Add(2);
        chartDataLabel2.ShowValue = true;

        // Set percentage format code.
        chartDataLabel2.NumberFormat.FormatCode = "0.00%";

        // Or you can set format code to be linked to a source cell,
        // in this case NumberFormat will be reset to general and inherited from a source cell.
        chartDataLabel2.NumberFormat.IsLinkedToSource = true;
        
        
      doc.Save("chart.docx");

i wnat delete legend and alose whant change color in chart… how to do it?

@ashok.suse

Please accept my apologies for late response.

You can use ChartLegend.Position property to hide chart legend by setting its value to LegendPosition.None.

Unfortunately, Aspose.Words does not provide API to change the color of chart series. We logged this feature request as WORDSNET-12275 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-12275) have been fixed in this Aspose.Words for .NET 21.6 update and this Aspose.Words for Java 21.6 update.