229
edits
(→grid) |
|||
Line 101: | Line 101: | ||
myRect.setStrokeLineWidth(3); | myRect.setStrokeLineWidth(3); | ||
canvas.plot2D.grid(myGroup,[120,100],20,25,[70,30],blue).setRotation(30*D2R); | canvas.plot2D.grid(myGroup,[120,100],20,25,[70,30],blue).setRotation(30*D2R); | ||
</syntaxhighlight> | |||
|| [[File:Plot2D.rectangle and grid.png|thumb]] | |||
|}<hz/> | |||
=== polyline === | |||
'''parameters''': (group, xSet, ySet, color="#0", symmetrical='') | |||
Plots a polyLine as <'''group'''>'s child. | |||
* '''xSet''' as [x0,...,xn] in pixels. | |||
* '''ySet''' as [y0,...,yn] in pixels. | |||
* '''color''' optional grid color as [r,g,b] or "#rrggbb". Black by default. | |||
* '''symmetrical''' optional string, may be 'x', 'y', 'xy' or 'yx'. | |||
{| class="wikitable" | |||
|- | |||
! example !! Screenshot | |||
|- | |||
| <syntaxhighlight lang="xml"> | |||
var window = canvas.Window.new([200,200],"dialog").set("title","Plot2D demo" ); | |||
var myCanvas = window.createCanvas().set("background", "#eeeeee"); | |||
var root = myCanvas.createGroup(); | |||
var myGroup = root.createChild("group"); | |||
var (red,blue,grey) = ['#ee0000', [0,0,1], [.8,.8,.8] ]; | |||
## with default values: | |||
canvas.plot2D.polyline(myGroup,[150,181,194,157,199],[162,130,174,138,146]); | |||
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100]); | |||
## with symmetrical = 'x': | |||
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"x") | |||
.setTranslation(-10,-10); | |||
## with symmetrical = 'y': | |||
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"y") | |||
.setTranslation(-10,-10); | |||
## with symmetrical = 'xy': | |||
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"x") | |||
.setTranslation(-10,-10); | |||
## with symmetrical = 'yx': | |||
canvas.plot2D.polyline(myGroup,[100,110,150],[50,90,100],'#0',"x") | |||
.setTranslation(-10,-10); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|| [[File:Plot2D.rectangle and grid.png|thumb]] | || [[File:Plot2D.rectangle and grid.png|thumb]] | ||
|} | |} | ||
=== grid === | |||
#p.del(); | |||
#var p=g | |||
#p.setTranslation(0,100); | |||
#var s='yx'; | |||
#print(s[0]); | |||
p=gca.plot2D.redim(p,[1.2,1.2],'center-bottom'); |
edits