[RESOLVED] How to Draw the Exact User defined Scale on PictureBox in VB6
Hi All,
I Need to draw a user defined graph in VB6.0, for that i used the PictureBox as my Plotting space.
I get the Input for plotting scale on PictureBox as per user input, the Main Problem I'm facing is if suppose the user input is in between -8 to 10 for X-axis and 98.39 to 98.876 for Y-axis the middle portion for scale shows wrong coordinates which could result into unexpected behaviour for my graph.
Plz could anyone tell me what should i have to do to plot my exact graph..
Waiting for reply soon...
:confused:
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
What function are you using to "plot" the values to the "graph"?
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
According to your coordinates, you should set the Form Scale like this:
Code:
Private Sub Form_Load()
With Picture1
.AutoRedraw = True
.DrawWidth = 2
.ScaleWidth = 18
.ScaleLeft = -8
.ScaleHeight = 98.39 - 98.876
.ScaleTop = 98.876
'Test: If the coordinates are correct,
' you should see a Diagonal line from
' left Up corner to Right Down corner..
.Line 3, -8, 98.876, 10, 98.39, vbBlue
End With
End Sub
Note that ScaleHeight contains a negative value, the reason: In VB Forms, the normal behavior of Y coordinates is become greater when you move down, but when working with mathematics (X and Y Axis) you need exatly the opposite, Y must grow when you move UP, thats the reason to assign a negative Value to ScaleHeight.
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Hi,
I Checked the code but its also not going to give me the exact results,
The problem occurs in this code again is :
Check for the X-axis co-ordinates, u can figure out the difference between the -1 to 1 points. As u see there the coordinates are placed in -0 to 0 and in between that the values moved to exponential form as (-1.948867E-02).
And i have 0 as a main coordinate in my graph plotting, so if i plot the graph on which 0th coordinate the point get placed??
waiting for u r reply .....
Thks and regds,
amolt....
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
-0 to 0? I don't understand what you say.
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
if -0 = 0 then -NULL = NULL :lol:
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Hi,
As per this code we are setting the X-axis:
.ScaleLeft = -8
.ScaleWidth = 18
so as logically we can devide the scale in two parts first is negative :
from (0 to -8) and from (0 to 18).
Now in this the mddle section or midpoint of this scale is 0.
But if u observe it by showing points in tooltip u observe the difference that the center point of 0 - coordinate actually plotted in terms of -0 and 0 and the central area of this will be in exponential form.
Thks n Regds,
amolt......
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Ah, you mean you want to plot floating point numbers? Such as 0.342342 that is in exponential form? :)
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Please have you gone through the code by testing it in app?
When you plot the scale between -8 to 18 the scale is divided into parts of floating point numbers.
so when we go near to 0 coordinate you will see the points as floating numbers and moving further to X-axis you find the thing what i m saying just check it out?
waiting ...
amolt..
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Which App?
Sorry for misunderstanding if any!
I just pronounce App to application made by the code given here.
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
I know App = Application, you have not posted your code....