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
-
<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
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>
Optional, will put a box underneath the text
widthnumber <optional>
Optional width of bounding box
heightnumber <optional>
Optional height of bounding box
-
<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.
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.
-
<static> lineTo()
-
-
<static> moveTo()
-
-
<static> newSeries()
-
Create a series. This supports either a text color or STXChart.Style object
- See:
-
<static> quadraticCurveTo()
-
-
<static> Series(name, strokeOrFill, color [, opacity] [, width])
-
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