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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Scatter Plot using MS Chart

Status
Not open for further replies.

wlaflamme

Technical User
Aug 1, 2003
22
0
0
US
Hello
i originally posted this in a VB.net forum but was told I might have succee in a VB6 forum. I am trying to create a scatter plot with 2 series of data but I am struggling to find out if MS Chart is capable of doing this? My code is below for performing one series.

Dim Graph(0 To 3, 0 To 1) As Double
Dim Graph2(0 To 1, 0 To 1) As Double
Dim z As Integer = 1

Graph(0, 0) = myCalibration.CalibAct(1)
Graph(1, 0) = myCalibration.CalibAct(2)
Graph(2, 0) = myCalibration.CalibAct(3)
Graph(3, 0) = myCalibration.CalibAct(4)
Graph(0, 1) = myCalibration.CalibRead(1)
Graph(1, 1) = myCalibration.CalibRead(2)
Graph(2, 1) = myCalibration.CalibRead(3)
Graph(3, 1) = myCalibration.CalibRead(4)
Graph2(0, 0) = 175
Graph2(1, 0) = 250
Graph2(0, 1) = 2
Graph2(1, 1) = 10


chtCalib.chartType = MSChart20Lib.VtChChartType.VtChChartType2dXY 'VtChChartType2dXY ' set to X Y Scatter chart
chtCalib.ChartData = Graph ' populate chart's data grid using Graph array
chtCalib.Plot.UniformAxis = False

'Add a title and legend.
With Me.chtCalib
.Title.Text = "Calibration Chart"
.Legend.Location.LocationType = _
MSChart20Lib.VtChLocationType.VtChLocationTypeBottom
.Legend.Location.Visible = True
End With

'Add titles to the axes.
With Me.chtCalib.Plot
.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).AxisTitle.Text = "Volts"
.Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).AxisTitle.Text = "Distance (mm)"
End With
With Me.chtCalib.Plot
'Yellow for Company A
' -1 selects all the datapoints.
.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set(200, 50, 200)
End With

End Sub

Any Help would be appreciated. Thanks
William
 
I'm sure I'll be corrected if I'm wrong but I believe the version of MSChart that ships with VB6 doesn't support all the features that the .net version does, so it's actually a key question whether you're using VB6 or .net?

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top