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!

Create Scatter Plot using MS Chart

Status
Not open for further replies.

wlaflamme

Technical User
Aug 1, 2003
22
0
0
US
Hello
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 haven't used it in years, so I don't know. Generally, you'll want to stay away from ActiveX controls in .Net development if at all possible. If you don't get an answer here, I would suggest posting this in the VB6 forum instead. Or, use the .Net Report Viewer control to create your chart.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top