chDimCategories changes owc chart issue !!!

W

wubin_98

Hi All,

Could anyone point out what is wrong in my code.

I am using owc11 to create a column stacked chart.

I found that following line of code will change my chart data colume
view.


seriesCollection.SetData(Owc11.ChartDimensionsEnum.chDimCategories,
Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, aMonthName(i))

Here is my source code. Is there a bug in my code?

Thanks,

BWU
--------------------------------------------------------------------------------------
ChartSpace1 = New Owc11.ChartSpace()

Dim c
c = ChartSpace1.Constants

Chart1 = ChartSpace1.Charts.Add
Dim aMonthName
ReDim aMonthName(5)
aMonthName(0) = "Apr"
aMonthName(1) = "may"
aMonthName(2) = "Jun"
aMonthName(3) = "Jul"
aMonthName(4) = "Aug"
aMonthName(5) = "Sep"
Dim seriesCollection As Owc11.ChSeries
Dim aX
ReDim aX(5)
i = 0
While i < (NumPoints - 2)
DataReader1.Read()
aX(0) = DataReader1.GetValue(1)
aX(1) = DataReader1.GetValue(2)
aX(2) = DataReader1.GetValue(3)
aX(3) = DataReader1.GetValue(4)
aX(4) = DataReader1.GetValue(5)
aX(5) = DataReader1.GetValue(6)

If (DataReader1.GetValue(0) <> 0) Then
LineName(i) = "Line " + DataReader1.GetValue(0)
Else
LineName(i) = "Any Line"
End If

seriesCollection = Chart1.SeriesCollection.Add(0)
seriesCollection.Type =
Owc11.ChartChartTypeEnum.chChartTypeColumnStacked

seriesCollection.SetData(Owc11.ChartDimensionsEnum.chDimSeriesNames,
Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, LineName(i))


seriesCollection.SetData(Owc11.ChartDimensionsEnum.chDimCategories,
Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, aMonthName(i))

seriesCollection.SetData(Owc11.ChartDimensionsEnum.chDimValues,
Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, aX)

i = i + 1
End While
 
W

wubin_98

I found that if I use following code outside of the loop. It works
fine. Is anybody know why?

Chart1.SetData(Owc11.ChartDimensionsEnum.chDimCategories,
Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, aMonthName)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top