Excel / C# - Clustered-Stacked Column Chart xvalues not updated

Viewed 10

I have a chart template of type Clustered-Stacked Column and want to change the data sources in C#. Unfortunately Excel does not update the values for the XValues. In Excel the X values are numbered from 1,2,3,4 ....

workbook.Charts["Template"].Copy(After: workbook.Worksheets[worksheet.Name]);
chart = workbook.Charts["Template (2)"];
chart.Name = "Diag Histogram";

chart.FullSeriesCollection(1).XValues = $"='{worksheet.Name}'!$A$1:$A${histogram.Count}";
chart.FullSeriesCollection(1).Values = $"='{worksheet.Name}'!$B$1:$B${histogram.Count}";

Excel Chart

Excel Worksheet

0 Answers
Related