Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Office Web Component OWC10 ChSeries.SetData method

Status
Not open for further replies.

drkestrel

MIS
Sep 25, 2000
439
GB
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):

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)
as opposed to just
Code:
arrX
, and the same goes for
Code:
arrY
.

Now, if I change
Code:
arrX
to contain date values
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 :(

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top