How to set up series. Points. DataLabel. LinkSource?Aspose.Cells v25.9

image.png (12.2 KB)

image.png (48.7 KB)

Still unable to take effect, I used WPS to create charts and series, using the same code. The files created by WPS can take effect, but using aspose.cells doesn’t

test.zip (12.8 KB)

@752659984

It looks like the chart‑series settings (Series, Points, DataLabel, LinkSource) are not being applied in the workbook you create with Aspose.Cells 25.9.
In the recent 25.x releases we have seen a few chart‑related regressions (e.g., pie‑chart exceptions and 3‑D rendering issues) that behave similarly – the chart objects are created but the visual changes are ignored.

What to try next

  1. Capture a minimal repro – create a tiny workbook (one sheet, one chart) that only sets the series, points, data‑label and link‑source.
    var wb = new Workbook();
    var ws = wb.Worksheets[0];
    // … add data …
    var chart = ws.Charts.Add(ChartType.Column, 5, 0, 20, 10);
    var ser = chart.Series[0];
    ser.Name = "Test";
    ser.Values = "A1:A5";
    ser.XValues = "B1:B5";
    
    // point‑level settings
    ser.Points[0].DataLabel.ShowValue = true;
    ser.Points[0].LinkSource = "C1";
    
    wb.Save("out.xlsx");
    
  2. Run the code on two versions – 25.9 (the one you are using) and the last 24.x build (e.g., 24.12.0.0). If the settings work in 24.x but not in 25.9, it confirms a regression.
  3. Enable detailed logging (if you have a support contract) to see whether any internal exception is being swallowed when the chart is saved.
  4. Provide the following to the support team
    • The exact code snippet you are using (the minimal repro above is ideal).
    • The generated .xlsx file (both the one produced by Aspose.Cells and the one produced by WPS for comparison).
    • The full version string of Aspose.Cells (e.g., 25.9.0.0).

Work‑around
If the issue is confirmed in 25.9, you can temporarily downgrade to the latest 24.x release where the chart‑series properties are applied correctly, or wait for the next patch that addresses the regression.

Please send the minimal sample and files so we can reproduce the problem and provide a definitive fix.

public static void TestCreate()
{
var wpsCreateWorkbook = new Workbook(“test.xlsx”);

var asposeCreateWorkbook = new Workbook();
var asposeWorksheet = asposeCreateWorkbook.Worksheets["Sheet1"];
asposeWorksheet.Cells["A1"].Value = "val";
asposeWorksheet.Cells["A2"].Value = 105;
asposeWorksheet.Cells["A3"].Value = 155;
asposeWorksheet.Cells["A4"].Value = 180;
asposeWorksheet.Cells["B1"].Value = "name";
asposeWorksheet.Cells["B2"].Value = "test1";
asposeWorksheet.Cells["B3"].Value = "test2";
asposeWorksheet.Cells["B4"].Value = "test3";
asposeWorksheet.Cells["C1"].Value = "custom";
asposeWorksheet.Cells["C2"].Value = "v201";
var chartIndex = asposeWorksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 5, 0, 15, 5);
var chart = asposeWorksheet.Charts[chartIndex];
var seriesIndex = chart.NSeries.Add("A2:A4", true);
var series = chart.NSeries[seriesIndex];
series.Name = "test";
chart.NSeries.CategoryData = "=B2:B4";
TestCreateChart(asposeCreateWorkbook, chart, series);

asposeCreateWorkbook.Save("aspose-result.xlsx");

//wps create file and chart
var wpsCreateChart = wpsCreateWorkbook.Worksheets["Sheet1"].Charts[0];
var wpsSeries = wpsCreateChart.NSeries[0];
TestCreateChart(wpsCreateWorkbook, wpsCreateChart, wpsSeries);

wpsCreateWorkbook.Save("wps-result.xlsx");

}

public static void TestCreateChart(Workbook workbook, Chart chart, Series series)
{
series.DataLabels.ShowValue = false;
series.DataLabels.ShowCellRange = true;
series.DataLabels.LinkedSource = “=A2:A4”;
series.DataLabels.Position = Aspose.Cells.Charts.LabelPositionType.OutsideEnd;
chart.Calculate();
series.Points[0].DataLabels.ShowValue = true;
series.Points[0].DataLabels.LinkedSource = “=Sheet1!C2”;
series.Points[0].DataLabels.Position = Aspose.Cells.Charts.LabelPositionType.OutsideEnd;
series.Points[0].DataLabels.IsAutoText = false;

chart.ValueAxis.MinValue = 50;
chart.ValueAxis.MaxValue = 200;

}

@752659984

Steps to configure a series, its points and custom data‑labels (including LinkedSource) in Aspose.Cells .NET v25.9

  1. Create the chart and the series

    int chartIdx = ws.Charts.Add(ChartType.Column, 5, 0, 15, 5);
    Chart chart = ws.Charts[chartIdx];
    
    // A2:A4 are the Y‑values, B2:B4 are the categories
    int seriesIdx = chart.NSeries.Add("A2:A4", true);
    Series series = chart.NSeries[seriesIdx];
    series.Name = "test";
    chart.NSeries.CategoryData = "=B2:B4";
    
  2. Set series‑level data‑label options

    series.DataLabels.ShowValue      = false;          // hide the default value
    series.DataLabels.ShowCellRange = true;           // show the source range
    series.DataLabels.LinkedSource  = "=A2:A4";       // range that supplies the label text
    series.DataLabels.Position      = LabelPositionType.OutsideEnd;
    
  3. Refresh the chart (required before touching points)

    chart.Calculate();
    
  4. Configure a single point (e.g., the first point) with its own label

    Point point = series.Points[0];
    
    point.DataLabels.ShowValue      = true;                     // show the value for this point
    point.DataLabels.LinkedSource  = "=Sheet1!C2";              // custom text for the point
    point.DataLabels.Position      = LabelPositionType.OutsideEnd;
    point.DataLabels.IsAutoText   = false;                     // use the LinkedSource text as‑is
    
  5. (Optional) Adjust the value axis limits

    chart.ValueAxis.MinValue = 50;
    chart.ValueAxis.MaxValue = 200;
    
  6. Save the workbook

    workbook.Save("result.xlsx");
    

Key points

Item Property / Method What it does
Series data‑labels Series.DataLabels Controls label appearance for the whole series.
Point‑specific label Series.Points[i].DataLabels Overrides series settings for an individual data point.
Linked source text DataLabels.LinkedSource Excel‑style formula (e.g., =A2:A4 or =Sheet1!C2) that supplies the label text.
Refresh chart Chart.Calculate() Must be called before accessing Points to ensure the series is built.

The code above follows the API definitions for Series, DataLabels, and the “Adding Custom Labels to Data Points” guide, and works with Aspose.Cells v25.9. Adjust the cell references (A2:A4, C2, etc.) to match your own data layout.

@752659984
By testing with sample file and code on the latest version v25.11, we can reproduce the issue. Chart data label loss when viewing result file in WPS.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-59490

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@752659984,

Although we will look into the issue and try to fix it soon for WPS Office compatibility for your needs. Generally, Aspose.Cells follows MS Excel standards and specifications and mimics the behavior of MS Excel. So, if you could use MS Excel to open the output file into MS Excel manually, you will find data labels are shown fine in the chart(s).