Making data plots

Earthednet-wp prothero at earthednet.org
Mon Sep 8 10:40:08 EDT 2014


Folks,
Thanks for all the good ideas. For line plots, I do create a line and set the points of the line to the values I want. For plots with discrete symbols (there may be many thousands), I draw directly into an image using a derivative of code I got from Colin's simple draw program. This works well, but I noticed a huge slowdown going to livecode 7, so I'll have to spend some time optimizing my repeat loops.

Grouping plot elements will simplify my code, and since I rely heavily on snapshots, I really appreciate that the dev team did some work to make it more robust.

Thanks again for the ideas and help.
Bill

William Prothero
http://es.earthednet.org

> On Sep 8, 2014, at 3:44 AM, Beat Cornaz <B.Cornaz at gmx.net> wrote:
> 
> Hi William,
> 
> If you have a line plot, I would use one single line and set the points of the line to the desired data points.
> 
> If you have multiple elements, the following might help. I use it to make grids,  but I think the principle can be used for charts as well.
> 
> You'll create a template object, which you clone all the time. For each cloned element, you set the selected to true and when you have enough, you group them (all the selected objects). Then you set the name of the last created group to whatever you like. You can now also delete that group by name.
> 
> Here's an example : The part in bold is the core of it. The rest you'll need to adapt to your needs
> 
> 
> on mouseUp
> 
> set the cursor to busy
> 
> -- ** Fld "Input" contais data about the grid
> 
>  put line 1 of fld "Input" into OffsetX
>  put line 2 of fld "Input" into OffsetY
>  put line 3 of fld "Input" into NrColums 
>  put line 4 of fld "Input" into NrRows
>  put line 5 of fld "Input" into SizeX
>  put line 6 of fld "Input" into SizeY
>  put line 7 of fld "Input" into GridX
>  put line 8 of fld "Input" into GridY
>  put line 9 of fld "Input" into BorderBreedte
>  put line 10 of fld "Input" into NameStart
> 
> 
>  repeat with x = 1 to NrColums 
> 
>    repeat with y = 1 to NrRows 
>      clone grc "Grc template"        -- ** The Template
> 
> -- ** Stuff to arrange and size the grid cells
>      set the width of it to SizeX
>      set the height it to SizeY
>      set the lineSize of it to BorderBreedte
>      set the left of it to x * GridX - (BorderBreedte * (x-1)) + OffsetX
>      set the bottom of it to  y * GridY - (BorderBreedte * (y-1)) + OffsetY
>           
>      set the lockLoc of it to true
> 
>        set the selected of it to true
>      put NameStart & y & "-" & x into tName
>      set the name of it to tName
> 
>    end repeat
>  end repeat
> 
>  group
>  set the name of last group to "GGGG"
>    select empty
> 
> set the cursor to Arrow
> end mouseUp
> 
> 
> Cheers, Beat
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list