Adding multiple rows for the same series on a line chart in .NET

I am trying to setup a graph that has data from up to 3 lines, all this data is related and needs to be in the same series. When i used excel I manually created the chart by using this “=(‘Remittance Report’!$B$36:$J$36,‘Remittance Report’!$B$58:$J$58)” but when I try to add “‘Remittance Report’!B36:J36,‘Remittance Report’!B58:J58” to my NSeries I get “Destination array was not long enough. Check destIndex and length, and the array’s lower bounds.” when I try to add it.

I am using version 4.5.0.0

Thanks

Hi,

It may not be supported in the older version like 4.5.0.0. Please try the attached version 4.7.1.22. I have tested to insert multiple data ranges while adding data series for the chart and it works fine.

If you still find the issue using the attached version, kindly create a sample console application, zip it and post it here to show the issue. We will check it soon.

Thank you.

Updated my DLL and problem is still occuring…
I manually created the graph and the series value is “=(Sheet2!$B$2:$B$4,Sheet2!$B$2:$B$4,Sheet2!$D$2:$D$4)” I also tried the code with sheet2 in range and nothing.

Code:
'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()

'Adding a new worksheet to the Excel object
Dim sheetIndex As Integer = workbook.Worksheets.Add()

'Obtaining the reference of the newly added worksheet by passing its sheet index
Dim worksheet As Worksheet = workbook.Worksheets(sheetIndex)

worksheet.Cells(“A2”).PutValue(“08/11/2009”)
worksheet.Cells(“A3”).PutValue(“08/10/2009”)
worksheet.Cells(“A4”).PutValue(“08/09/2009”)

worksheet.Cells(“B2”).PutValue(50)
worksheet.Cells(“B3”).PutValue(100)
worksheet.Cells(“B4”).PutValue(150)

worksheet.Cells(“C2”).PutValue(“DO NOT ADD TO GRAPH”)
worksheet.Cells(“C3”).PutValue(“DO NOT ADD TO GRAPH”)
worksheet.Cells(“C4”).PutValue(“DO NOT ADD TO GRAPH”)

worksheet.Cells(“D2”).PutValue(4)
worksheet.Cells(“D3”).PutValue(20)
worksheet.Cells(“D4”).PutValue(50)

'Adding a chart to the worksheet
Dim chartIndex As Integer = worksheet.Charts.Add(ChartType.LineStackedWithDataMarkers, 5, 0, 15, 5)

'Accessing the instance of the newly added chart
Dim chart As Chart = worksheet.Charts(chartIndex)

'Adding NSeries (chart data source) to the chart ranging from “A1” cell to “B3”
chart.NSeries.Add(“B2:B4,D2:D4”, True)

'Saving the Excel file
workbook.Save(“C:\book1.xls”, FileFormatType.Default)

end code

Hi,

Thanks for providing us sample code.

Please change the line:

chart.NSeries.Add("B2:B4,D2:D4", True)

with:

chart.NSeries.Add("B2,B3,B4,D2,D3,D4", True)


We will check the feasibility if we can support to add data series ranges set in the format like, "B2:B4,D2:D4.....".

Thank you.

That works! Thanks!

Hi,

Please try the attached version, we have supported to add non Contiguous ranges as the source of the data series now.

Thank you.

The issues you have found earlier (filed as 10040) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Note: Just for your knowledge. In the new release v4.8.0, we have merged Aspose.Grid suite to Aspose.Cells for .NET msi installer as Aspose.Grid would be no longer offered as a separate product now. You need to install the installer (uninstall older one first if you have) and use only Aspose.Cells.dll library in your project for your need. You may also take advantage using Aspose.Cells Grid suite though.