Changing Canvas Scale

I have checked the documentation and cannot find it. Before I make any conclusion that this is not available, I would like to just ask about it so as not to miss it if it is available in another form elsewhere.

By default, the co-ordinate 0,0 is at the top-left while the canvas size (say 600,600) is at the bottom-right. I am looking at how I may change this. Example x-axis has 0 to 200 days and y-axis scale from $0 to $100.

Since I am coming from VB6 (and after a few years of proscatination, I want to do new projects in Xojo), I will give example how I do this in VB6. The equivalent to Canvas in VB6 is PictureBox and the default co-ordinate is same as the Xojo Canvas. To change the PictureBox co-ordinate scale, I do it like this:

PictureBox.Scale (0,0) - (200,100)

With this I get the PictureBox co-ordinate to be 0,0 at the bottom-left and 200,100 at the top-right, which is how a normal graph looks like.

Is this possible? If not possible, I know I can do some maths to get the drawing correct like back in my QuickBasic days.

There is no built in function for this. But the math is pretty simple.

Hi Tim,

Thanks for the confirmation.

Yes the maths is easy. The older programs I use the maths while the newer ones I use the “.Scale”. Here is an example of the math way of drawing on the picturebox so I will just replicate whatever I can. The math is taken from what I did in QuickBasic, which in turn was taken from AppleSoft Basic.

If you are looking to ZOOM (in or out) on an existing picture… use the functionality provided by DRAWPICTURE
this allows you to create a “portal” (select a part of the picture or the entire thing), and to draw it at a larger or smaller size

Read the documentation in the Lang Ref… its very easy once you understand the parameters… it goes WAY beyond the simply manipulation that VB6 provided

Hi Dave,

Thanks for the info. Yes ZOOM is something that is common for this type of program. It is especially useful when one want to use the chart to explain certain point or to include in a commentary.

Is drawing your traces using Object2D any use to you, this can be scaled.

Hi Mike,

I am not familiar with Object2D so I need reading up. If it can, will be interesting.

Thanks.