ChartConfig interface defines all available options for configuring a chart’s appearance, behavior, and data.
ChartConfig
Main configuration object passed to the Chart constructor orupdate() method.
Width of the chart in pixels. If not specified, defaults to the container’s width.
Height of the chart in pixels. If not specified, defaults to the container’s height.
Configuration for the X axis. See AxisConfig below.
Configuration for the Y axis. See AxisConfig below.
Array of series to display on the chart. Each series can be a line, bar, pie, or scatter series. See SeriesConfig below.
Visual theme for the chart. Affects background colors, text colors, and axis colors.Default:
'light'When
true, the Y axis will start from zero if all Y values are positive. This provides better visual context for magnitude comparisons.Default: trueWhen
true, the X axis will start from zero if all X values are positive.Default: falseExample
AxisConfig
Configuration options for chart axes (both X and Y).Minimum value for the axis domain. If not specified, calculated automatically from data.
Maximum value for the axis domain. If not specified, calculated automatically from data.
Type of scale to use for the axis.
'numeric': Linear scale for numeric data (default)'datetime': Time scale for date/time data'categorical': Categorical scale for string labels
'numeric'Whether to display the axis. When
false, hides both axis lines and labels.Default: true (except for pie charts, which default to false)Number of tick marks and labels to display on the X axis.Default:
10Number of tick marks and labels to display on the Y axis.Default:
10Custom formatter function for X axis labels. Receives the numeric value and should return a formatted string.
Custom formatter function for Y axis labels. Receives the numeric value and should return a formatted string.
Color for grid lines (CSS color string). If not specified, uses theme default.
Color for axis labels and tick text (CSS color string). If not specified, uses theme default.
CSS font specification for axis labels.Default:
'12px sans-serif'Theme for the axis appearance. Usually set automatically from the chart’s theme.Default:
'light'For categorical axes, enables horizontal scrolling when there are many categories. When
true, the chart becomes horizontally scrollable if there are more than 20 categories or if explicitly enabled.Default: false (auto-enabled for >20 categories)Example
SeriesConfig
Union type for all series configurations. Each chart can contain multiple series of different types.BaseSeriesConfig
Common properties shared by all series types.Type of series:
'line', 'bar', 'pie', or 'scatter'Display name for the series, shown in the legend and tooltips.
CSS color string for the series. If not specified, a color is automatically assigned from the chart’s color palette.
Whether the series is visible. Hidden series are not rendered but remain in the chart.Default:
trueLineSeriesConfig
Configuration for line series.Must be
'line'Array of data points. Each point must have
x and y properties.Example
BarSeriesConfig
Configuration for bar series.Must be
'bar'Array of data points. Each point must have
x and y properties.Width of each bar in pixels. If not specified, calculated automatically based on available space.
When
true, shows bar heights relative to the minimum value in the dataset. This is useful for visualizing small variations in data with large baseline values.Default: falseAlignment of bars relative to their X value.
'center': Bar is centered on the X value (default for regular bar charts)'start': Bar starts at the X value (useful for histograms)'end': Bar ends at the X value
'center'Reserved for future stacked bar chart support. Currently not used directly by series.
Example
PieSeriesConfig
Configuration for pie and donut charts.Must be
'pie'Array of pie segments. Each segment has a label and value.
Inner radius as a fraction of the outer radius (0-1). Use values > 0 to create a donut chart.
0: Full pie chart (default)0.5: Donut chart with 50% inner radius0.7: Donut chart with 70% inner radius
0Example
ScatterSeriesConfig
Configuration for scatter plot series.Must be
'scatter'Array of data points. Each point must have
x and y properties.Radius of each scatter point in pixels.Default:
4Example