How to manipulate Canvas elements: Difference between revisions

Jump to navigation Jump to search
Line 8: Line 8:


=== line ===
=== line ===
Plots a line as <group>'s child.
Plots a line as <'''group'''>'s child.
'''Parameters:''' (group, from, to, color)<br />
'''Parameters:''' (group, from, to, color)<br />
* '''from''' as [x,y] in pixels.
* '''from''' as [x,y] in pixels.
Line 32: Line 32:
<hr/>
<hr/>
=== hzLine ===
=== hzLine ===
Plots an horizontal line as <group>'s child.<br />
Plots an horizontal line as <'''group'''>'s child.<br />
'''Parameters:''' (group, from, length, color)
'''Parameters:''' (group, from, length, color)
* '''from''' as [x,y] in pixels.
* '''from''' as [x,y] in pixels.
Line 39: Line 39:
<hr/>
<hr/>
=== vtLine ===
=== vtLine ===
Plots a vertical line as <group>'s child.<br />
Plots a vertical line as <'''group'''>'s child.<br />
'''Parameters:''' (group, from, length, color)
'''Parameters:''' (group, from, length, color)
* '''from''' as [x,y] in pixels.
* '''from''' as [x,y] in pixels.
Line 46: Line 46:
<hr/>
<hr/>
=== dashedLine ===
=== dashedLine ===
Plots a vertical line as <group>'s child.<br />
Plots a vertical line as <'''group'''>'s child.<br />
'''Parameters:''' (group, from, length, color)
'''Parameters:''' (group, from, length, color)
* '''from''' as [x,y] in pixels.
* '''from''' as [x,y] in pixels.
Line 70: Line 70:
<hr/>
<hr/>
=== rectangle ===
=== rectangle ===
Plots a rectangle as <group>'s child.<br />
Plots a rectangle as <'''group'''>'s child.<br />
'''Parameters:''' (group, size ,origin=nil, color="#0", fill=nil, rounded=nil)
'''Parameters:''' (group, size ,origin=nil, color="#0", fill=nil, rounded=nil)
* '''size''' as [width,height] in pixels.
* '''size''' as [width,height] in pixels.
Line 79: Line 79:
<hr/>
<hr/>
=== grid ===
=== grid ===
Plots a grid as <group>'s child.<br />
Plots a grid as <'''group'''>'s child.<br />
'''Parameters:''' (group, size, dx, dy, origin=nil, color="#0", border=1)
'''Parameters:''' (group, size, dx, dy, origin=nil, color="#0", border=1)
* '''size''' as [width,height] in pixels.
* '''size''' as [width,height] in pixels.
Line 91: Line 91:
! example !! Screenshot
! example !! Screenshot
|-
|-
| <syntaxhighlight>
| <syntaxhighlight lang="xml">
var window = canvas.Window.new([200,200],"dialog").set("title","Plot2D demo"  );
var window = canvas.Window.new([200,200],"dialog").set("title","Plot2D demo"  );
var myCanvas = window.createCanvas().set("background", "#eeeeee");
var myCanvas = window.createCanvas().set("background", "#eeeeee");
Line 103: Line 103:
</syntaxhighlight>
</syntaxhighlight>
|| [[File:Plot2D.rectangle and grid.png|thumb]]
|| [[File:Plot2D.rectangle and grid.png|thumb]]
|}<hz/>
|}<hr/>
=== polyline ===
=== polyline ===
  '''parameters''': (group, xSet, ySet, color="#0", symmetrical='')
  '''parameters''': (group, xSet, ySet, color="#0", symmetrical='')
229

edits

Navigation menu