229
edits
No edit summary |
|||
Line 152: | Line 152: | ||
|} | |} | ||
<hr/> | <hr/> | ||
=== | === graphic === | ||
'''parameters''': (group, | '''parameters''': (group, ySet, dx=1, origin=nil, color="#0" | ||
Plots | Plots the curve sampled in <'''ySet'''> with a resolution of <'''dx'''>. | ||
* '''ySet''' as [y0,...,yn] in pixels. | * '''ySet''' as [y0,...,yn] in pixels. | ||
* '''dx''' optional curve resolution in pixels. 1 px by default. | |||
* '''origin''' optional as [x,y] in pixels, [0,0] by default. | |||
* '''color''' optional grid color as [r,g,b] or "#rrggbb". Black by default. | * '''color''' optional grid color as [r,g,b] or "#rrggbb". Black by default. | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 165: | Line 165: | ||
| | | | ||
{{Note| This assumes that you already have a top-level root group set up, and his ''group'' child named '''myGroup'''. }} <syntaxhighlight lang="nasal"> | {{Note| This assumes that you already have a top-level root group set up, and his ''group'' child named '''myGroup'''. }} <syntaxhighlight lang="nasal"> | ||
var (red,blue,green,orange) = ['#ee0000', [0,0,1], [0,0.8,0], '#ea9a32' ]; | var (red,blue,green,orange) = ['#ee0000', [0,0,1], [0,0.8,0], '#ea9a32' ]; | ||
var yValues = []; | |||
for(var i=0;i<460;i+=4) append(yValues, 30*math.sin(i*D2R)); | |||
canvas.plot2D.hzLine(myGroup, [10,100],175,blue); | |||
canvas.plot2D.vtLine(myGroup, [15,180],-175,blue); | |||
canvas.plot2D.graphic(myGroup, yValues,,[]15,100,red); | |||
canvas.plot2D. | |||
canvas.plot2D. | |||
canvas.plot2D. | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|| [[File:Plot2D.polyline.png|thumb|plot2D.polyline example]] | || [[File:Plot2D.polyline.png|thumb|plot2D.polyline example]] | ||
|} | |} |
edits