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.
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.