日期:2014-05-16  浏览次数:20442 次

通过wz_jsgraphics在js上画图
setColor( "#HexColor" );

Specifies the color of the drawing "pen". Once set, this color will be used by the subsequently called drawing methods until it will be overridden through another call of setColor(). The value must be enclosed in quotation marks, and should be hexadecimal following the pattern "#rrggbb" (as usual with HTML). Color names available in HTML (for instance "maroon") may be used as well.指定绘图颜色的“笔”。一旦设置,将使用此颜色由所谓的绘图方法,直到后来便)重写通过另一个调用setColor(。值必须用引号,应该十六进制下面的模式“#rrggbb”(通常为HTML的)。颜色名称在HTML中可用(例如为“栗色”)可作为良好。
jg.setColor("#ff0000");

or with identical result或具有相同的结果

jg.setColor("red");
setStroke( Number );

Specifies the thickness of the drawing "pen" for lines and bounding lines of shapes. Once set, this thickness will be used by the subsequently called drawing methods until it will be overridden through another call of setStroke(). Default line thickness is 1?px, as long as .setStroke() has not yet been invoked.指定绘图厚度的“笔”形状的线条和边界线。一旦设置,这个厚度将在其后所使用的方法称为图纸,直到将覆盖厚度通过另一个电话setStroke()。默认是1像素线,只要。setStroke()尚未被调用。

To create dotted lines, setStroke() requires the constant Stroke.DOTTED as argument. Width of dotted lines is always 1 pixel.要创建虚线,setStroke()需要不断的争论Stroke.DOTTED作为。线条宽度的点永远是1像素。
jg.setStroke(3);

or

jg.setStroke(Stroke.DOTTED);
drawLine( X1, Y1, X2, Y2 );
<script type="text/javascript"></script>
?
Line from the first to the second pair of coordinates. Line thickness is either 1?px or the value most recently specified by .setStroke() .从第一行到第二个双坐标。线的厚度是1像素值或最近指定。setStroke()。
jg.drawLine(20,50,453,40);
drawPolyline( Xpoints, Ypoints );
<script type="text/javascript"></script>
?
A polyline is a series of connected line segments. Xpoints and Ypoints are arrays which specify the x and y coordinates of each point as follows:阿段折线是一系列连接线。Xpoints和Ypoints是数组的指定X和Y坐标点每如下:
var Xpoints = new Array(x1,x2,x3,x4,x5);
var YPoints = new Array(y1,y2,y3,y4,y5);