Hi,
I have values for X and Y. How To make a chart/grapgh out of it in MSChart? Because so far, all the examples that I see use only one value, which is X.
Thanks
Printable View
Hi,
I have values for X and Y. How To make a chart/grapgh out of it in MSChart? Because so far, all the examples that I see use only one value, which is X.
Thanks
Not sure where you are getting your values from (database?) but this is how I plot X and Y values on a Line Chart for my golf stats program. HTH :)
VB Code:
sSQL = "SELECT * FROM tblHandicap ORDER BY CompDate ASC" rsHandicap.Open sSQL, strCn, adOpenStatic, adLockOptimistic ReDim arrHandicap(0 To rsHandicap.RecordCount - 1, 1 To 2) For i = 0 To rsHandicap.RecordCount - 1 arrHandicap(i, 1) = Format(rsHandicap!CompDate, "Short Date") ' Horizontal Values arrHandicap(i, 2) = rsHandicap!NewHand ' Vertical Values rsHandicap.MoveNext Next i MSChart1.Title = "Title Of Your Graph" MSChart1.ChartData = arrHandicap 'Array Values MSChart1.chartType = VtChChartType2dLine 'Type of chart rsHandicap.Close Set rsHandicap = Nothing
Hi,
Thanks.. even though it didnt show any difference between my chart and yours.. probably because the my Y value is very2 low. But how to set the scale?
My Y value is between 0.00091491 to 0.01646844 and X Value is between (71,000.00) to 60,334.00. Currently my chart looks really2 small because the value of Y is less then 1.
Thanks
To set the Max/Min values for your X and Y axis use the below code.
VB Code:
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = YourValue MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = YourValue MSChart1.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = YourValue MSChart1.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = YourValue
add the checkmark, and the word [RESOLVED] to the subject of your first post to resolve the thread
Hi
:confused: I received an error message: "OVERFLOW"Quote:
For i = 0 To iCount - 1
Values(i, 1) = rs!X ' Horizontal Values
Values(i, 2) = rs!Y ' Vertical Values
rs.MoveNext
Next i
:confused: Did you declared your arrHandicap as single?
Thanks
I used the below to declare my array. Depending on how big/small your values are you might want to declare your array as Double.
VB Code:
Dim arrHandicap()