Class: Plotter

CIQ. Plotter

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.


<static> addText(name, text, x, y [, backgroundColor] [, width] [, height])

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

Name Type Argument Description
name string

Name of series

text string

The raw text to render

x number

X position on canvas for text

y number

Y position on canvas for text

backgroundColor string <optional>

Color to use on the box underneath the text

width number <optional>

Width of bounding box

height number <optional>

Height of bounding box

<static> bezierCurveTo()

  • 4.0.0

<static> dashedLineTo()

<static> 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.

Name Type Argument Description
context object

A valid HTML canvas context

name string <optional>

Optionally render only a specific series. If null or not provided then all series will be rendered.

<static> lineTo()

<static> moveTo()

<static> newSeries()

Create a series. This supports either a text color or CIQ.ChartEngine.Style object


<static> quadraticCurveTo()

<static> reset(name)

Clear out any moves or text stored in the plotter for series "name"

Name Type Description
name string

Name of series to reset. If omitted, will reset all series in plotter.

  • 3.0.0

<static> Series(name, strokeOrFill, color [, opacity] [, width] [, pattern])

Define a series to plot. A series is a specific color and referenced by name

Name Type Argument Default Description
name string

Name of series

strokeOrFill boolean

If true then a stroke operation, otherwise a fill operation

color string

A valid canvas color

opacity number <optional>

A valid opacity from 0-1

width number <optional>

A valid lineWidth from 1

pattern string <optional>

A valid pattern (solid, dotted, dashed)

  • 4.0.0 added parameter pattern