Making data plots

Geoff Canyon gcanyon at gmail.com
Mon Sep 8 02:53:31 EDT 2014


I generally use a utility command, something like:

on forceNControls pID,N
  put max(2,N + 1) into M
  repeat (the number of controls of pID) - M + 1
    delete control M of pID
  end repeat
  set the vis of control 1 of pID to (N > 0)
  repeat with i = (the number of controls of pID)  to N - 1
    clone control i of pID
  end repeat
end forceNControls



On Mon, Sep 8, 2014 at 1:45 AM, Terence Heaford <t.heaford at btinternet.com>
wrote:

> I to do a similar thing when creating a pie chart in a group.
>
> All the chart handlers are in the group.
>
> Here is an example for creating a segment of a pie chart:
>
> on drawASegment
> tLeft,tTop,tRight,tBottom,tRadius,tStartAngle,tArcAngle,tColor
>    set the style of the templateGraphic to oval
>    create grc in me
>    put the id of the last grc of me into tID
>    set the antialiased of grc id tID to true
>    set the rect of grc id tID to tLeft,tTop,tRight,tBottom
>    set the startangle of grc id tID to tStartAngle
>    set the arcangle of grc id tID to tArcAngle
>    set the backcolor of grc id tID to tColor
>    set the showFill of grc id tID to true
>    set the forecolor of grc id tID to tColor
>    set the lineSize of grc id tID to 1
>    set the locked of grc id tID to true
> end drawASegment
>
> When deleting the chart I use this handler which does not delete the
> group, rather it deletes the objects of the group:
>
> on deleteChart
>    put the childControlNames of me into tObjectList
>    lock screen
>    if tObjectList is not empty then
>       repeat with n = 1 to the number of lines in tObjectList
>          put line n of tObjectList into tObject
>          if exists(tObject) then
>             delete tObject
>          else
>             put "OBJECT DOES NOT EXIST " & tObject
>          end if
>       end repeat
>    end if
>    unlock screen
> end deleteChart
>
> Hopefully this will give you some ideas.
>
> All the best
>
> Terry
>
>
>
> On 07 Sep 2014, at 21:49, William Prothero <prothero at earthednet.org>
> wrote:
>
> > Folks:
> > I’ve been working on an app that plots various kinds of data. For some
> of the data, where I need a line plot, I create lines, boxes, labels, etc,
> and after they are displayed, I take a snapshot of the graphic and then
> delete the objects that I used to create the plot. So far, as a beginning
> live coder, I’ve just stored the names of the graphic elements of the plot
> in an array, then deleted them using the array entries. But, it seems, as
> the plots are getting more complex, that it might be easier or more
> efficient to put the objects for a single plot into a group, then I can
> delete the entire group in one operation.
> >
> > The dictionary has some entries on creating groups, but I can’t find
> anything about adding a single object to a group. I want to do this so that
> each time an element of the plot is created, it is added to the group. That
> way, I don’t have to keep track of the objects myself. Is there a tutorial
> where I can find this information?
> >
> > Also, I am assuming that if I delete a group, all of the objects in it
> are also deleted.
> >
> > Best,
> > Bill
> >
> > William A. Prothero, Ph.D.
> > University of California, Santa Barbara Dept. of Earth Sciences
> (Emeritus)
> > Santa Barbara, CA. 93105
> > http://es.earthednet.org/
> >
> >
> >
> > _______________________________________________
> > 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
>
> _______________________________________________
> 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