scaling points of a graphic

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

scaling points of a graphic

Post by adventuresofgreg » Thu Jan 05, 2012 4:30 pm

Hi: I have a script that plots price data as a bar chart and it is working well, but I am running into some problems with large numbers.

The basic method is simple (shown without the HLOC bar drawing complexities):

mydata:
1,2001
2,2002
3,2008
4,2001

To plot it:
set the points of graphic "existingGraphic" to mydata

To scale the new plot:
set the rect of graphic "existingGraphic" to the rect of graphic "TheFrame"

The problem is when I attempt to plot numbers larger than 5 digits, sometimes the resulting plot is all over the place, sometimes I can plot 6 digits - the problem seems a bit intermittent - perhaps related to the spread between the max and min of myData.
Attachments
plot.jpg

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: scaling points of a graphic

Post by adventuresofgreg » Thu Jan 05, 2012 4:37 pm

I attached a simple plot testing stack to demonstrate the problem. Note when you increase the number in the "Scale amount" field to 3 or higher, the plot starts to look funny

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: scaling points of a graphic

Post by adventuresofgreg » Thu Jan 05, 2012 4:40 pm

the attachment didnt work - how do i attach a livecode file??

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: scaling points of a graphic

Post by adventuresofgreg » Thu Jan 05, 2012 4:42 pm

trying to attach a zip file...
Attachments
PlotTester.livecode.zip
Plot tester
(10.9 KiB) Downloaded 249 times

Post Reply