|
-
Apr 19th, 2007, 10:36 AM
#1
Thread Starter
Lively Member
[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...
-
Apr 19th, 2007, 05:04 PM
#2
Hyperactive Member
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"?
-
Apr 19th, 2007, 11:28 PM
#3
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.
Last edited by jcis; Apr 19th, 2007 at 11:33 PM.
-
Apr 22nd, 2007, 06:29 AM
#4
Thread Starter
Lively Member
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....
-
Apr 22nd, 2007, 08:21 AM
#5
Hyperactive Member
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
-
Apr 22nd, 2007, 03:35 PM
#6
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
-0 to 0? I don't understand what you say.
-
Apr 23rd, 2007, 02:33 AM
#7
Hyperactive Member
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
if -0 = 0 then -NULL = NULL
-
Apr 25th, 2007, 10:30 AM
#8
Thread Starter
Lively Member
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......
-
Apr 26th, 2007, 02:43 AM
#9
Hyperactive Member
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?
-
Apr 29th, 2007, 01:47 AM
#10
Thread Starter
Lively Member
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..
-
Apr 29th, 2007, 04:26 PM
#11
Hyperactive Member
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
Which App?
-
Jun 11th, 2007, 12:26 AM
#12
Thread Starter
Lively Member
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.
-
Jun 12th, 2007, 12:47 PM
#13
Hyperactive Member
Re: How to Draw the Exact User defined Scale on PictureBox in VB6
I know App = Application, you have not posted your code....
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
|