|
-
Oct 11th, 2004, 10:11 PM
#1
Thread Starter
Member
MsChart - (X,Y)[REsolved]
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
Last edited by blackdevil1979; Oct 17th, 2004 at 11:11 PM.
-
Oct 11th, 2004, 10:21 PM
#2
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
-
Oct 12th, 2004, 01:29 AM
#3
Thread Starter
Member
MsCHart-(X,Y) continue
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
-
Oct 12th, 2004, 01:36 AM
#4
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
-
Oct 12th, 2004, 02:31 AM
#5
add the checkmark, and the word [RESOLVED] to the subject of your first post to resolve the thread
-
Oct 12th, 2004, 03:10 AM
#6
Thread Starter
Member
Hi
For i = 0 To iCount - 1
Values(i, 1) = rs!X ' Horizontal Values
Values(i, 2) = rs!Y ' Vertical Values
rs.MoveNext
Next i
I received an error message: "OVERFLOW"
Did you declared your arrHandicap as single?
Thanks
-
Oct 12th, 2004, 03:50 AM
#7
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|