API Reference
Namespaces
Classes
Events
Global
Externals

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.

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
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>
1

A valid opacity from 0-1

width number <optional>
1

A valid lineWidth from 1

pattern string <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
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

meta object <optional>

Object containing metadata

Properties
Name Type Argument Description
centered boolean <optional>

Should draw text centered

vertical string <optional>

Should draw text vertically; pass CIQ.Plotter.BOTTOM_TO_TOP or CIQ.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
name string

Name of series

cx0 number

First control point x-coord

cy0 number

First control point y-coord

cx1 number

Second control point x-coord

cy1 number

Second control point x-coord

x number
y number
Since:
  • 4.0.0


dashedLineTo(name, x, y, pattern)

Parameters:
Name Type Description
name string

Name of series

x number
y number
pattern string

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


lineTo(name, x, y)

Parameters:
Name Type Description
name string

Name of series

x number
y number

moveTo(name, x, y)

Parameters:
Name Type Description
name string

Name of series

x number
y number

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
name string

Name of series

strokeOrFill boolean

If true then a stroke operation, otherwise a fill operation

colorOrStyle object | string

Color or object containing color, opacity, width, borderTopStyle (solid, dotted, dashed)

opacity number <optional>

A valid opacity from 0-1

width number <optional>
1

A valid lineWidth from 1

See:
  • CIQ.Plotter.Series

quadraticCurveTo(name, cx0, cy0, x, y)

Parameters:
Name Type Description
name string

Name of series

cx0 number

Control point x-coord

cy0 number

Control point y-coord

x number
y number

reset(name)

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

Parameters:
Name Type Description
name string

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

Since:
  • 3.0.0