Chart: XValues ignored if ChartType=line


#1

I would like my chart to use a range of cells as category axis labels. If the chart type is Scatter, this works fine:

Dim xlChart As Aspose.Cells.Chart = xlSheet.Charts(xlSheet.Charts.Add(Aspose.Cells.ChartType.Line, 0, 0, 10, 10))

xlChart.NSeries.Add("sheet!B1:B10", True)

Dim xlSeries As Aspose.Cells.ASeries = xlChart.NSeries.Item(0)

xlSeries .XValues = "sheet!A1:A10"

In the above case, the values in sheet!A1:A10 appear. But if I change the ChartType property to "Line" what appears are the row numbers, and I can't figure out how to make those values appear again.


#2

For line chart, I think you should set CategoryData. Please try:

Dim xlChart As Aspose.Cells.Chart = xlSheet.Charts(xlSheet.Charts.Add(Aspose.Cells.ChartType.Line, 0, 0, 10, 10))

xlChart.NSeries.Add("sheet!B1:B10", True)

x.Chart.NSeries.CategoryData = "sheet!A1:A10"