AxisLayer
Renders X and Y axes with labels, tick marks, and theme support.Constructor
The DOM element to attach the canvas layer to
The stacking order of this layer
Configuration options for axis appearance and behavior
Methods
Sets the scale objects used to convert data values to pixel positions
Renders the axes and labels to the canvas
AxisConfig
Configuration interface for customizing axis appearance and behavior.Whether to display the axes
The type of data being displayed
Minimum value for the axis domain (overrides auto-calculated range)
Maximum value for the axis domain (overrides auto-calculated range)
Number of tick marks to display on the X axis
Number of tick marks to display on the Y axis
Custom formatter function for X axis labels
Custom formatter function for Y axis labels
Color of the grid lines (CSS color value)
Color of the axis labels. If not specified, uses theme-based colors
CSS font specification for axis labels
Visual theme for the axes
Whether the axis supports scrolling (for large datasets)
Smart label formatting
When no customyLabelFormat is provided, the Y axis automatically formats large numbers for better readability:
- Values >= 1,000,000 display as “M” (millions):
2.5M - Values >= 1,000 display as “K” (thousands):
15K - Values >= 1 display with up to 1 decimal place:
42.5 - Values < 1 display with up to 2 decimal places:
0.25
Example
GridLayer
Renders a grid of horizontal and vertical lines for visual reference.Constructor
The DOM element to attach the canvas layer to
The stacking order of this layer (typically lower than data layers)
Methods
Sets the scale objects used to position grid lines
Renders the grid to the canvas
Example
Notes
- Grid draws 10 vertical and 10 horizontal lines by default
- Grid color is hardcoded to
#333(consider using GridLayer for backgrounds) - Grid lines span the full range of each axis