Making data plots

Beat Cornaz B.Cornaz at gmx.net
Mon Sep 8 06:44:27 EDT 2014


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






More information about the use-livecode mailing list