Click to See Complete Forum and Search --> : Plotting Graphs
dev
July 31st, 2001, 12:05 AM
How do I plot graphs in visual basic.
I have 2 sets of array values (one for x axis, one for y axis).
Could you provide me examples on how to plot graphs?
Thank You.
Dev.
Tower
July 31st, 2001, 12:56 AM
Sub PlotGraph(x(),y())
ScaleMode = 3 'set scale in pixel
DrawWidth = 8 'set width line
for i = 0 to UBound(x) - 1
Line (x(i), y(i))-(x(i + 1), y(i + 1))
next i
End Sub
SACEIT
July 31st, 2001, 03:59 AM
Add a msChart to your formadd this code under command 1Option Explicit
Private Sub Command1_Click()With MSChart1 Dim arrData(1 To 3, 1 To 3)
arrData(1, 1) = "Jan" ' Set the labels in thefirst series.
arrData(2, 1) = "Feb" arrData(3, 1) = "Mar" arrData(1, 2) = 8
arrData(2, 2) = 4 arrData(3, 2) = 0.3 arrData(1, 3) = 0.2
arrData(2, 3) = 3 arrData(3, 3) = 6.3 MSChart1.ChartData = arrData
End WithEnd Sub
TheAvenger
August 1st, 2001, 02:46 AM
'You mean:
'Add a msChart to your form
'add this code under command 1
option Explicit
private Sub Command1_Click()
Dim arrData(1 to 3, 1 to 3)
arrData(1, 1) = "Jan" ' set the labels in thefirst series.
arrData(2, 1) = "Feb"
arrData(3, 1) = "Mar"
arrData(1, 2) = 8
arrData(2, 2) = 4
arrData(3, 2) = 0.3
arrData(1, 3) = 0.2
arrData(2, 3) = 3
arrData(3, 3) = 6.3
MSChart1.ChartData = arrData
End Sub
Next time enclose your post in *[vbocde]* and *[/vbcode]* tags (without "*" chars)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.