new Plotter()
The Plotter is a device for managing complex drawing operations on the canvas. The HTML 5 canvas performs better when drawing operations of the same color are batched (reducing the number of calls to the GPU). The plotter allows a developer to store those operations in a normal control flow, and then have the Plotter deliver the primitives to the canvas. The plotter can also be used as a caching mechanism for performing the same operations repeatedly. The y-axis of the chart uses this mechanism to boost performance.
Methods
-
Series(name, strokeOrFill, color [, opacity] [, width] [, pattern])
-
Define a series to plot. A series is a specific color and referenced by name
Parameters:
Name Type Argument Default Description namestring Name of series
strokeOrFillboolean If true then a stroke operation, otherwise a fill operation
colorstring A valid canvas color
opacitynumber <optional>
1 A valid opacity from 0-1
widthnumber <optional>
1 A valid lineWidth from 1
patternstring <optional>
solid A valid pattern (solid, dotted, dashed)
- Since:
-
4.0.0 added parameter pattern
-
addText(name, text, x, y [, backgroundColor] [, width] [, height] [, meta])
-
Add text to be rendered with the drawing. Primarily used when the Plotter is used for caching since there is no performance benefit from batching text operations to the GPU. If specifying a bounding box, textBaseline="middle" is assumed
Parameters:
Name Type Argument Description namestring Name of series
textstring The raw text to render
xnumber X position on canvas for text
ynumber Y position on canvas for text
backgroundColorstring <optional>
Color to use on the box underneath the text
widthnumber <optional>
Width of bounding box
heightnumber <optional>
Height of bounding box
metaobject <optional>
Object containing metadata
Properties
Name Type Argument Description centeredboolean <optional>
Should draw text centered
verticalstring <optional>
Should draw text vertically; pass
CIQ.Plotter.BOTTOM_TO_TOPorCIQ.Plotter.TOP_TO_BOTTOM- Since:
-
9.2.0 added metadata param to support vertical text
-
bezierCurveTo(name, cx0, cy0, cx1, cy1, x, y)
-
Parameters:
Name Type Description namestring Name of series
cx0number First control point x-coord
cy0number First control point y-coord
cx1number Second control point x-coord
cy1number Second control point x-coord
xnumber ynumber - Since:
-
4.0.0
-
dashedLineTo(name, x, y, pattern)
-
Parameters:
Name Type Description namestring Name of series
xnumber ynumber patternstring A valid pattern (solid, dotted, dashed)
-
draw(context [, name])
-
Render the plotter. All of the stored operations are sent to the canvas. This operation stores and restores global canvas parameters such as fillStyle, strokeStyle and globalAlpha.
Parameters:
Name Type Argument Description contextobject A valid HTML canvas context
namestring <optional>
Optionally render only a specific series. If null or not provided, then all series will be rendered.
-
lineTo(name, x, y)
-
Parameters:
Name Type Description namestring Name of series
xnumber ynumber -
moveTo(name, x, y)
-
Parameters:
Name Type Description namestring Name of series
xnumber ynumber -
newSeries(name, strokeOrFill, colorOrStyle [, opacity] [, width])
-
Create a series. This supports either a text color or CIQ.ChartEngine.Style object
Parameters:
Name Type Argument Default Description namestring Name of series
strokeOrFillboolean If true then a stroke operation, otherwise a fill operation
colorOrStyleobject | string Color or object containing color, opacity, width, borderTopStyle (solid, dotted, dashed)
opacitynumber <optional>
A valid opacity from 0-1
widthnumber <optional>
1 A valid lineWidth from 1
- See:
-
- CIQ.Plotter.Series
-
quadraticCurveTo(name, cx0, cy0, x, y)
-
Parameters:
Name Type Description namestring Name of series
cx0number Control point x-coord
cy0number Control point y-coord
xnumber ynumber -
reset(name)
-
Clear out any moves or text stored in the plotter for series "name"
Parameters:
Name Type Description namestring Name of series to reset. If omitted, will reset all series in plotter.
- Since:
-
3.0.0
