Chart class is the main entry point for creating charts with Kinetix. It manages the rendering, data, interactions, and all visual elements of your chart.
Constructor
Create a new chart instance by providing a container element and optional configuration.The DOM element that will contain the chart. The chart will automatically size to fit this container.
Optional configuration object to initialize the chart with series, axes, theme, and other settings. See the Configuration page for details.
Example
Public properties
The DOM element containing the chart.
Array of all series currently in the chart.
Padding around the chart area. Default:
{ top: 20, right: 20, bottom: 40, left: 60 }Start Y axis from zero when all values are positive. Default:
trueStart X axis from zero when all values are positive. Default:
falseMethods
update
Update the chart with new configuration, replacing existing series and settings.Complete or partial chart configuration to apply. This will replace any existing series if
config.series is provided.addSeries
Add a new series to the chart without removing existing series.Configuration for the series to add. Can be a line, bar, pie, or scatter series configuration.
Example
pan
Pan the chart view horizontally. Only works with numeric/datetime axes (not categorical).Horizontal pixel offset to pan. Positive values pan right, negative values pan left.
Vertical pixel offset (currently not used, reserved for future use).
Example
zoom
Zoom the chart view in or out around a specific pixel position.Zoom factor. Values > 1 zoom in, values < 1 zoom out. For example,
2 zooms in 2x, 0.5 zooms out 2x.The pixel position (X coordinate) around which to zoom.
Example
toggleSeries
Toggle the visibility of a series by index.Zero-based index of the series to toggle.
Example
setSeriesVisibility
Set the visibility of a specific series.Zero-based index of the series to modify.
Whether the series should be visible.
Example
getSeriesInfo
Get information about all series in the chart.Example
updateAxis
Update axis configuration without recreating the chart.Partial X axis configuration to merge with existing settings.
Partial Y axis configuration to merge with existing settings (currently uses same config as X axis).
Example
setGridVisible
Show or hide the grid lines.Whether the grid should be visible.
Example
setTheme
Change the chart theme.The theme to apply.
Example
updateSeries
Update properties of a specific series by index.Zero-based index of the series to update.
Partial series configuration with properties to update (color, name, visible).
Example
getCanvasImage
Generate a PNG data URL of the chart for export or display.Optional export settings.
Scale factor for high resolution export. Default:
2 (for retina displays). Use 1 for standard resolution.Target width in pixels. Defaults to current chart width.
Target height in pixels. Defaults to current chart height.
Custom view window in data coordinates (advanced usage).
<img> tag or downloaded.
Example
downloadImage
Download the chart as a PNG image file.Name of the file to download. Default:
'chart.png'Optional export settings (same as
getCanvasImage options).Scale factor for high resolution. Default:
2Target width in pixels.
Target height in pixels.
Custom data window to export (xMin, xMax, yMin, yMax).
Example