Scatter graph not plotting Y Axis using VB.Net & owc11

M

Mark

Hi All,

I'm using the code below to draw a scatter graph via VB.Net, however the
points are not being plotted on the graph.

Anyone come across this problem before?
Public Sub Main()

Dim IsConnected As Boolean

Dim myConnection As SqlConnection

Dim myConnectionString As String

Dim ds As DataSet

Dim minXValue As Date

Dim maxXValue As Date

'graphing values

Dim SmallXDim As Int32 = 615

Dim SmallYDim As Int32 = 415

'call sub to set globals

GetAmIMasterSettings("item")

'get Data

ds = RetrieveAllConnections()

Dim dsRows As Integer = ds.Tables(0).Rows.Count - 1

Dim doubleDataX(dsRows) As Double

Dim doubleDataY(dsRows) As Double

Dim hostInTime(dsRows) As String

Dim logons(dsRows) As Int16

Dim i As Integer = 0

While i <= dsRows

Dim dsRow As DataRow = ds.Tables(0).Rows(i)

hostInTime(i) = CStr(CDate((dsRow("LogonTime"))))

logons(i) = CShort(CInt(dsRow("LogonDelay")))

doubleDataX(i) = CType(dsRow("x"), Double)

doubleDataY(i) = CType(dsRow("LogonDelay"), Double)

i += 1

End While

minXValue = CDate(hostInTime(0))

maxXValue = CDate(hostInTime(dsRows))

'charts

Dim chartSpace As New Owc11.ChartSpace

Dim chartType As Owc11.ChartChartTypeEnum

'Dim chart As Object

Dim chartSeriesLogons As Object

With chartSpace

..Charts.Add()

..Charts(0).SeriesCollection.Add(0)

..Charts(0).Type = Owc11.ChartChartTypeEnum.chChartTypeScatterMarkers

..Charts(0).HasTitle = True

..Charts(0).Title.Caption = "Logons"

End With

'Make the chart legend visible

With chartSpace

..Charts(0).HasLegend = True

..Charts(0).Legend.Position = Owc11.ChartLegendPositionEnum.chLegendPositionTop

End With

'.Axes(c.chAxisPositionBottom)

With chartSpace.Charts(0).Axes(1)

..Scaling.Minimum = minXValue.ToOADate()

..Scaling.Maximum = maxXValue.ToOADate()

..NumberFormat = "hh:mm:ss"

..MajorUnit = (1 / 24) / 60

'ax.Orientation = Owc11.c.chLabelOrientationUpward

End With

'set up the Series

chartSpace.Charts(0).SetData(Owc11.ChartDimensionsEnum.chDimSeriesNames,
Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, "Logons")

chartSpace.Charts(0).SeriesCollection(0).SetData(Owc11.ChartDimensionsEnum.chDimYValues, (Owc11.ChartSpecialDataSourcesEnum.chDataLiteral), doubleDataY)

chartSpace.Charts(0).SeriesCollection(0).SetData(Owc11.ChartDimensionsEnum.chDimXValues, (Owc11.ChartSpecialDataSourcesEnum.chDataLiteral), doubleDataX)



IsConnected = IsConnectible(WebServer_1, 2, 100)

'connect to live server

If IsConnected = IsConnectible(WebServer_1, 2, 100) Then

With chartSpace

..ExportPicture(SmallOutputGIFLocation, "gif", SmallXDim, SmallYDim)

..ExportPicture(LargeOutputGIFLocation, "gif", 780, 560)

End With

End If

'connect to DR Server & export chart

If IsConnected = IsConnectible(WebServer_2, 2, 100) Then

With chartSpace

..ExportPicture(SmallOutputGIFLocation, "gif", SmallXDim, SmallYDim)

..ExportPicture(LargeOutputGIFLocation, "gif", 780, 560)

End With

End If

End Sub



Many Thanks,

Mark.
 
C

cook.jonathan.m

I could be completey wrong about this as I've only been messing with
OWC11 for a little while. But I believe your y-axis (categories) and
x-axis (values) need to be strings since you are using the
chDataLiteral enum as your datasource type. I had to concatenate all
of my categories and values to two strings, respectively, that are then
delimited by a comma. y = "cars, trucks, boats"
x = "10, 15, 20"

and OWC seems to do the rest. Just watch out for the auto grouping
enum!
 

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