graph and fonction

Sarah sarahr at genesearch.com.au
Sun Nov 17 20:24:01 EST 2002


Will these scripts will work, they will be quite slow as they drag from 
point to point. A faster way is to create a single polygon object and 
set it's points to your coordinates.

on mouseUp
   -- this creates a graphic to show the chart.
   if there is not a grc "Chart" then
     create grc "Chart"
     choose browse tool
   end if
   set the style of grc "Chart" to "polygon"

   -- this creates a blue cross-shaped marker for the points.
   set the markerPoints of grc "Chart" to "0,2" & cr & "4,2" & cr & "" & 
cr & "2,0" & cr & "2,4"
   set the hiliteColor of grc "Chart" to "blue"

   -- the points of the graphic are stored in this list
   put empty into thePoints

   -- the main loop just sets the points rather than drawing as it goes
   repeat with i = 0 to  360
     -- calculate the x & y coordinates of each point here
     put xPoint & comma & yPoint & cr after thePoints
   end repeat

   -- implement the drawing in a single step
   set the points of grc "Chart" to thePoints
end mouseUp

Cheers,
Sarah


On Monday, November 18, 2002, at 08:11  am, Wilhelm Sanke wrote:

> On Sun, 17 Nov 2002,  Grudet at aol.com wrote
>
>> Please what are the instructions for dysplaying graph functions in a 
>> stack
>> How can i do to plot points and line on a stack by programming
>>
>> Thanks for help
>>
> Hello,
>
> here is an example to draw functions from a stack used to introduce
> students:
>
>
> - The first sript sets the values for the coordinates (and is then
> called from the first mouseup-handler):
>
> on Koordinaten
>    choose line tool
>   drag from (10 , 125) to (370, 125)
>   drag from (10 , 0) to (10 , 250)
>   set the width of the templateField to 25
>   set the height of the templateField to 25
>   set the textAlign of the templateField to "center"
>   set the opaque of the templateField to false
>   set the showBorder of the templateField to false
> end Koordinaten
>
> - the x- and y-axis is drawn:
>
> on mouseUp
>  call Koordinaten of this stack
>   create field "y-1"
>   set the loc of field "y-1" to (10 , 25)
>   put "1" into field "y-1"
>   create field "x-180"
>   set the loc of field "x-180" to (190 , 125)
>   put "180" into field "x-180"
>   choose browser tool
>   set the layer of image 1 to 1
> end mouseUp
>
> - a sinus curve is drawn:
>
> on mouseUp
>    choose line tool
>   drag from (10 , 125) to (370, 125)
>   choose curve tool
>   repeat with i = 0 to  360
>     put ( -sin(i * pi / 180)) into yeins
>     put ( -sin((i + 1) * pi / 180)) into yzwei
>     drag from (i + 10 , 125 + 100 * yeins) to ((i + 10 + 1), 125 + 100 
> *
> yzwei)
>   end repeat
>   choose browser tool
>   set the layer of image 1 to 1
> end mouseUp
>
> Parts of these scripts could be simplified.
>
> Hope this information is helpful.
>
> Regards,
>
> Wilhelm Sanke
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>





More information about the use-livecode mailing list