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

Free Support Forum - aspose.com

Words (.NET) - Line chart - How to fill series with empty (null) values?

Hello, we have purchased license.
We use Line chart with N series, and in some series values by some categories may be empty.
For example:

var shape = builder.InsertChart(ChartType.Line, height, width);
var chart = shape.Chart;
    
chart.Series.Add("series 1", 
    new[] { "cat1", "cat2", "cat3", "cat4", "cat5"},
    new[] { 5,      5,      5,      5,      5 });
    
chart.Series.Add("series 2", 
	new[] { "cat1", "cat2", "cat3", "cat4", "cat5"},
	new[] { 1,       null,   5,      null,  7 });

But we cannot have null values in series, since ChartSeriesCollection.Add method signature is Add(string seriesName, string[] categories, double[] values);

However, in Microsoft Word we can have empty (null) values in this case.
How can we achieve this?

@buryginl,

You can use double.NaN values instead of null values. In your case, to add the series with empty values to the chart, you can use following code:

chart.Series.Add("series 2", 
	new[] { "cat1", "cat2", "cat3", "cat4", "cat5"},
	new[] { 1, double.NaN, 5, double.NaN, 7 });

Thanks for answer, it helped me a lot.