G.draw ()

Read(4204) Label: draw, canvas,

Description:

Draw a chart.

Syntax:

G.draw(w,h)

Note:

The function draws a chart on a canvas object of w(width) * h (height) and calculates the hyperlink string. The format of image returned is specified by an option, and the default one is an SVG image with the hyperlink.

Parameter:

G

The canvas object.

w/h

The width and height of the canvas object, whose unit is pixels. When both w and h are less than 1, use the current screen resolution ratio.

Option:

@j

Return a JPG canvas.

@g

Return a GIF canvas.

@p

Return a PNG canvas.

Return value:

Image byte stream

Example:

 

A

 

1

=canvas()

Define a canvas object.

2

=A1.plot("Text",

"text":"hello word!",

"width":200,

"height":200,

"barType":256,

"data1":250,

"data2":250)

Use Text element to plot a 2D barcode.

"text":"hello word!"  means the text content is hello word!

"width":200,"height":200 means both  width and height of the 2D barcode are 200 pixels;

"barType":256 means the barcode type is 2D barcode;

"data1":250,"data2":250 means both the horizontal coordinate and the vertical coordinate of the canvas pixel are 250 pixels.

3

=A1.draw(400,400)

Draw a chart whose width and height are both 400 pixels. Click Browse Graph and the following 2D barcode is displayed:

 

4

=A1.draw@p(400,400)

Use @p option to return a canvas of PNG format and whose width and height are both 400 pixels.

Related function:

  canvas()

  G.plot()