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

Free Support Forum - aspose.com

Problem with scatter chart to image

@Amjad_Sahi
I found the same problem when using table data to draw scatter chart and render images.
Sample code:
Workbook workbook = new Workbook(“e:\sactter.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];

        int chartIndex = worksheet.Charts.Add(ChartType.Scatter, 0, 5, 20, 15);
        Chart chart = worksheet.Charts[chartIndex];
        var chartRange = $"{CellsHelper.CellIndexToName(1, 2)}:{CellsHelper.CellIndexToName(11, 2)}";
        chart.NSeries.Add(chartRange, true);
        chart.NSeries.CategoryData = $"{CellsHelper.CellIndexToName(1, 1)}:{CellsHelper.CellIndexToName(11, 1)}";
        chart.ShowLegend = false;
        chart.PlotArea.Area.FillFormat.FillType =FillType.None;
        chart.PlotArea.Border.FormattingType = ChartLineFormattingType.None;
        chart.ValueAxis.MajorGridLines.FormattingType = ChartLineFormattingType.None;
        chart.CategoryAxis.TickLabels.NumberFormat = "General";
        chart.ValueAxis.TickLabels.NumberFormat = "General";

        var series = chart.NSeries[0];
        series.DataLabels.Position = LabelPositionType.Above;
        series.DataLabels.LinkedSource = $"=Sheet2!$A$2:$A$12";
        series.DataLabels.ShowCellRange = true;
        series.HasLeaderLines = false;

        chart.ValueAxis.MaxValue = 100;
        chart.ValueAxis.MajorUnit =14;
        chart.ValueAxis.MinValue = 72;
        chart.CategoryAxis.MaxValue = 100;
        chart.CategoryAxis.MinValue = 86;
        chart.CategoryAxis.MajorUnit = 7;

        chart.ToImage("e:\\output.png", ImageFormat.Png);

ExcelAndImage.zip (10.8 KB)

@Beyond5566,

Thanks for the template file, sample code and image file.

Please notice, I am able to reproduce your issue by using your sample code with your template file. I found data labels on scatter chart are not rendered correctly in the output image. I used the latest version (20.4) of Aspose.Cells for .NET:

I have logged a ticket with an id “CELLSNET-47341” for the issue. We will look into it soon.

Once we have an update on it, we will let you know.

@Beyond5566,

Just to inform you that we are scheduled to publish our next official release, i.e., Aspose.Cells for .NET v20.6 in the next week. The new release includes the enhancement we made for your issue (although the issue not fixed completely). We recommend you kindly give it a try to the latest version (once it will be released).

@Beyond5566,

Please try our latest Aspose.Cells for .NET v21.6 .

Your issue should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSNET-47341) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao