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 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>
Optional, will put a box underneath the text
width
number <optional>
Optional width of bounding box
height
number <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 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 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 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