I am having troubles creating line/scattered graphs with Date as the X-axis value in VB.NET.
The following very trivial example does work, IFF the DataReference parameter is passed as a Tab seperated String (it won't work with a String array or a int32 array):
Note it does has to be
as opposed to just
, and the same goes for
.
Now, if I change
to contain date values
i.e.
Then, without changing other codes, the graph goes up 45 degrees from the first to the fourth reading, and between the fourth and last reading the line turns left pointing to pointing to 250 degrees or so. It obviously has got the dates confused!
Now, if I make an additional (more logical) change:
I got a graph with no lines and no dots!!!!
Wassup
The following very trivial example does work, IFF the DataReference parameter is passed as a Tab seperated String (it won't work with a String array or a int32 array):
Code:
Dim objChartSeries As OWC10.ChSeries
'Either of the following line works as expected
'chsDataPresentation.Charts.Item(0).Type =
OWC10.ChartChartTypeEnum.chChartTypeScatterLineMarkers
chsDataPresentation.Charts.Item(0).Type =
OWC10.ChartChartTypeEnum.chChartTypeScatterLineMarkers
chsDataPresentation.Charts.Item(0).Axes(0).Title.Caption = "Values"
chsDataPresentation.Charts.Item(0).Axes(1).Title.Caption = "Date"
objChartSeries = chsDataPresentation.Charts.Item(0).SeriesCollection.Add()
Dim arrX As String() = {1, 2, 3, 4, 5}
Dim arrY As String() = {1, 3, 5, 7, 6}
objChartSeries.SetData(OWC10.ChartDimensionsEnum.chDimXValues,
OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, Join(arrX, vbTab))
objChartSeries.SetData(OWC10.ChartDimensionsEnum.chDimYValues,
OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, Join(arrY, vbTab))
chsDataPresentation.Visible = True
chsDataPresentation.Refresh()
Note it does has to be
Code:
Join(arrX,vbTab)
Code:
arrX
Code:
arrY
Now, if I change
Code:
arrX
i.e.
Code:
'UK Date format
Dim arrX As String() = {"1/1/1999", "2/3/1999", "5/6/1999", "7/8/1999",
"2/1/2000"}
Then, without changing other codes, the graph goes up 45 degrees from the first to the fourth reading, and between the fourth and last reading the line turns left pointing to pointing to 250 degrees or so. It obviously has got the dates confused!
Now, if I make an additional (more logical) change:
Code:
objChartSeries.SetData(OWC10.ChartDimensionsEnum.chDimCategories,
OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, Join(arrX, vbTab))
I got a graph with no lines and no dots!!!!
Wassup