graph functions
Sarah Reichelt
sarahr at genesearch.com.au
Wed Apr 7 20:02:43 EDT 2004
> Anyone have any xTalk visual graphing functions already cooked up?
>
I have used Ken Simon's chart object, but it is too powerful for a lot
of uses. I started experimenting with a simpler solution and came up
with a really neat way to use Revolution and it's graphic objects.
Say you had a set of data like this:
1,10
2,5
3,8
4,1
5,7
6,7
7,4
8,10
9,2
10,6
It all has to be integers so round them or multiply all the values by a
factor of 10 until you get integers for every bit of data. Don't worry
about scaling yet.
Now create a graphic object and set it's style to polygon and set's
it's points to the data set. This creates a tiny little chart somewhere
on the screen.
BUT, if you now change the size of the chart, the data points all scale
automatically. I found the easiest way was to have a rectangular
graphic object and just set the rect of my chart graphic to the rect of
my background graphic.
Now the only problem is that the chart is upside down, so I took the
script from the revmenu stack for flipping a graphic object, and there
it is. A really simple line chart.
I have an example stack which I will put on my web page over the
weekend, but if anyone wants it today, send me an email off list.
Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/
More information about the use-livecode
mailing list