Data Series problem

Hello,

I am trying to add data series to chart as a set of non continuous cells. In excel this is done like: A1;A3;A5. How to define data series in Aspose.Cells to do the same ?

When I try do it this way it interprets it as three different data series.

Regards,

Kamil


This message was posted using Aspose.Live 2 Forum

Hi,

If you want to add three different data series, see following codes:

NSeries nSeries = chart.NSeries;
nSeries.Add("A1", true);
nSeries.Add("A3", true);
nSeries.Add("A5", true);

If you want to add a data series which value is contiguous cells, see following codes:
nSeries.Add("A1,A3,A5", true);

Thanks for the response.

I have the following situation. Lets say I have a worksheet with chart let it be “Charts” worksheet.
Then I have the “ChartData” worksheet on which is the data that I want to display on chart.

The data is placed in following cells:
H1,H3,H5 on “ChartData” worksheet

When I add the series manually in Excel chart source data is saved as following:
=‘ChartData’!$H$1;‘ChartData’!$H$3;‘ChartData’!$H$5

So I have one series with data from those cells.

The similar problem I have with category.

When I tried your solution with cells delimited by commas each of H1, H3, H5 cells were
interpreted as different data series.

Could you advise me how to manage such situation to create chart with only one data series.

Thanks in advance.

Kamil

Hi Kamil,

No I don't find this problem, I tested the following code and it adds only one data series.

.
.
int chartIndex = 0;
chartIndex = sheet.Charts.Add(ChartType.Pie3DExploded,1,1,25,10);
Chart chart = sheet.Charts[chartIndex];
//Set properties of nseries
chart.NSeries.Add("ChartData!H1,ChartData!H3,ChartData!H5", true);
chart.NSeries.CategoryData = "ChartData!G1,ChartData!G3,ChartData!G5";
.
.
.
Which version of Aspose.Cells you are using?
Thank you.