229
edits
Line 151: | Line 151: | ||
|| [[File:Plot2D.polyline.png|thumb|plot2D.polyline example]] | || [[File:Plot2D.polyline.png|thumb|plot2D.polyline example]] | ||
|} | |} | ||
<hr/> | |||
=== graphic === | |||
'''parameters''': (group, ySet, dx=nil, origin=nil, color="#0" | |||
Plots the curve sampled in <'''ySet'''> with a resolution of <'''dx'''>. | |||
* '''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. | |||
{| class="wikitable" | |||
|- | |||
! example !! Screenshot | |||
|- | |||
| | |||
{{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 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); | |||
</syntaxhighlight> | |||
|| [[File:Plot2D,graphic.png|thumb]] | |||
<hr/> | <hr/> | ||
=== graphic === | === graphic === | ||
Line 170: | Line 193: | ||
canvas.plot2D.hzLine(myGroup, [10,100],175,blue); | canvas.plot2D.hzLine(myGroup, [10,100],175,blue); | ||
canvas.plot2D.vtLine(myGroup, [15,180],-175,blue); | canvas.plot2D.vtLine(myGroup, [15,180],-175,blue); | ||
canvas.plot2D.graphic(myGroup, yValues,,[ | canvas.plot2D.graphic(myGroup, yValues,,[15,100],red); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|| [[File:Plot2D | || [[File:Plot2D,graphic.png|thumb]] | ||
<hr/> |
edits