Class: DiagramCanvas

algeobraCanvas~DiagramCanvas(params)

Drawing utilities for a Html canvas element

Constructor

new DiagramCanvas(params)

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
x0 Number <optional>
The x origin
y0 Number <optional>
The y origin
x1 Number <optional>
The x end
x1 Number <optional>
The y end
flipY Boolean <optional>
Specifies whether the y axis should be flipped
canvas HTMLCanvasElement | PathOutput The output canvas
Source:

Methods

begin(params)

Clear the canvas
Parameters:
Name Type Description
params Object
Properties
Name Type Description
fillAlpha Boolean If true, the canvas will be filled with opaque white, otherwise it will be cleared
Source:

drawAngle(x, y, angle, start, style)

Draws an angle Style options and defaults can be found at styles.geo.angle
Parameters:
Name Type Description
x Number x coordinate in local space
y Number y coordinate in local space
angle Number The angle itself
start Number Where the angle starts
style Object
Source:

drawArc(x, y, r, startAngle, endAngle, style)

Draws an arc Style options and defaults can be found at styles.geo.arc
Parameters:
Name Type Default Description
x Number x coordinate in local space
y Number y coordinate in local space
r Number radius in local space
startAngle Number 0 The start angle
endAngle Number The end angle
style Object
Source:

drawBackground(config)

Draws a background All options can be found in the BASIC_BACKGROUND_CONFIG object
Parameters:
Name Type Description
config Object The background config
Source:

drawBezier(points, style)

Draws a Bezier curve Style options and defaults can be found at styles.geo.line
Parameters:
Name Type Description
points Array.<{x:Number, y:Number}> Control point coordinates in local space
style Object
Source:

drawBezierSpline(points, degree, style)

Draws a Bezier spline Style options and defaults can be found at styles.geo.line
Parameters:
Name Type Description
points Array.<{x:Number, y:Number}> Control point coordinates in local space
degree Number The degree of the spline
style Object
Source:

drawEllipse(x, y, rx, ry, startAngle, endAngle, rotation, style)

Draws an ellipse Style options and defaults can be found at styles.geo.arc
Parameters:
Name Type Description
x Number x coordinate in local space
y Number y coordinate in local space
rx Number x-eccentricity in local space
ry Number y-eccentricity in local space
startAngle Number The start angle
endAngle Number The end angle
rotation Number The rotation of the ellipse
style Object
Source:

drawLine(x0, y0, x1, y1, leftOpen, rightOpen, style)

Draws a line Style options and defaults can be found at styles.geo.line
Parameters:
Name Type Description
x0 Number x coordinate in local space of the first point
y0 Number y coordinate in local space of the first point
x1 Number x coordinate in local space of the second point
y1 Number y coordinate in local space of the second point
leftOpen Boolean Specifies, whether the line extends to infinity from the first point
rightOpen Boolean Specifies, whether the line extends to infinity from the second point
style Object
Source:

drawLineStrip(points, style)

Draws a line strip Style options and defaults can be found at styles.geo.line
Parameters:
Name Type Description
points Array.<{x:Number, y:Number}> Point coordinates in local space
style Object
Source:

drawPoint(x, y, style)

Draws a point Style options and defaults can be found at styles.geo.point
Parameters:
Name Type Description
x Number x coordinate in local space
y Number y coordinate in local space
style Object
Source:

drawPolygon(points, style)

Draws a polygon Style options and defaults can be found at styles.geo.polygon
Parameters:
Name Type Description
points Array.<{x:Number, y:Number}> Point coordinates in local space
style Object
Source:

drawText(x, y, text, style)

Draws text Style options and defaults can be found at styles.geo.text
Parameters:
Name Type Description
x Number x coordinate in local space
y Number y coordinate in local space
text String
style Object
Source:

drawVector(x0, y0, x1, y1, style)

Draws a vector from the first to the second point Style options and defaults can be found at styles.geo.vector
Parameters:
Name Type Description
x0 Number x coordinate in local space of the first point
y0 Number y coordinate in local space of the first point
x1 Number x coordinate in local space of the second point
y1 Number y coordinate in local space of the second point
style Object
Source:

updateViewport(params)

Update the visible viewport
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
x0 Number <optional>
The x origin
y0 Number <optional>
The y origin
x1 Number <optional>
The x end
x1 Number <optional>
The y end
Source: