chart
Configuration Structure
chart: {}chart
width
'100%'Width of the chart (pixels or percentage). See the full reference on the chart.height & chart.width page.
height
'auto'Height of the chart (pixels, percentage, or auto golden-ratio). See the full reference on the chart.height & chart.width page.
type
'line'Selects the chart type (line, area, bar, pie, and more). See the full reference on the chart.type page.
foreColor
'#373d3f'Sets the text color for the chart. Defaults to #373d3f.
fontFamily
'Helvetica, Arial, sans-serif'Sets the font family for all text elements of the chart. Defaults to 'Helvetica, Arial, sans-serif'
background
''Background color for the chart area. If you want to set background with css, use .apexcharts-canvas to set it.
offsetX
0Sets the left offset for the entire chart.
offsetY
0Sets the top offset for the entire chart.
dropShadow
enabled
falseEnable a dropshadow for paths of the SVG
enabledOnSeries
undefinedProvide series index on which the dropshadow should be enabled.
top
2Set top offset for shadow
left
2Set left offset for shadow
blur
4Set blur distance for shadow
color
'#000'Give a color to the shadow. If array is provided, each series can have different shadow color
opacity
0.7Set the opacity of shadow.
nonce
undefinedNonce attribute added to the style tag for CSP (Content Security Policy). If set, the nonce will be appended to the style tag.
injectStyleSheet
trueBy default, ApexCharts injects its required CSS into the document <head> the first time a chart is rendered. Set this to false if you want to manage chart styles yourself (e.g. by importing apexcharts/dist/apexcharts.css in your bundle) and prevent the runtime injection.
id
undefinedA chart ID is a unique identifier that will be used in calling certain ApexCharts methods. Also used in group option to sync charts. You will also need chart.id to be set in case you use updateOptions() or exec() methods.
group
undefinedSetting chart.group with a common name for multiple charts will sync the tooltip, panning, and zooming across all charts with the same group name. Each chart needs to have a unique chart.id.
Example:
// Chart 1
var chart1 = new ApexCharts(el, {
chart: {
id: 'chart1',
group: 'social',
}
})
// Chart 2
var chart2 = new ApexCharts(el, {
chart: {
id: 'chart2',
group: 'social',
}
})
defaultLocale
'en'Use this option to set the default locale. Requires the locales array to have the locale data for that locale name.
locales
name
Name of the locale you will be defining options for. Can be en, fr, etc.
options
months
['January', ..., 'December']Full month names in your preferred language
shortMonths
['Jan', ..., 'Dec']Abbreviations of months
days
['Sunday', ..., 'Saturday']Full names of days in your language
shortDays
['Sun', ..., 'Sat']Abbreviated day names
toolbar
download
'Download SVG'Tooltip title text which appears when you hover over download icon
selection
'Selection'Tooltip title text which appears when you hover over selection icon
selectionZoom
'Selection Zoom'Tooltip title text which appears when you hover over selection zoom icon
zoomIn
'Zoom In'Tooltip title text which appears when you hover over zoom in icon
zoomOut
'Zoom Out'Tooltip title text which appears when you hover over zoom out icon
pan
'Panning'Tooltip title text which appears when you hover over pan icon
reset
'Reset Zoom'Tooltip title text which appears when you hover over reset icon
exportToSVG
'Download SVG'Label text for the "Download SVG" entry in the export menu.
exportToPNG
'Download PNG'Label text for the "Download PNG" entry in the export menu.
exportToCSV
'Download CSV'Label text for the "Download CSV" entry in the export menu.
parentHeightOffset
15A small padding is applied to the bottom of the chart area to make the chart look neat. You may not need this in case you set a fixed height. This is useful if you have a sparkline chart in a small container.
redrawOnParentResize
trueRe-render the chart when the element is resized. Useful if a chart is rendered in a dynamically sized container.
redrawOnWindowResize
trueRe-render the chart when the window is resized. Useful in cases where auto-resizing on window resize may cause issues.
sparkline
Sparkline mode hides axes, grid, and labels to render a compact chart for small areas. See the full reference on the chart.sparkline page.
stackType
'normal'When stacked, should the stacking be percentage based or normal stacking. Available options:
'normal''100%'
stackOnlyBar
trueWhen using a combo chart (line and bar together), stack only the bar series and leave the line series unstacked.
toolbar
The toolbar is the menu in the top-right corner (download, zoom, pan, reset, selection) plus SVG/PNG/CSV export. See the full reference on the chart.toolbar page.
zoom
Enable and configure zooming: per-axis zoom, auto-scale y-axis, mouse-wheel zoom, and the zoomed-area styling. See the full reference on the chart.zoom page.
selection
Enable and style rectangular selection on the x, y, or both axes, with optional preset ranges. See the full reference on the chart.selection page.
animations
Control load and update animations: speed, gradual animation, dynamic-data animation, chart-type morphing, and reduced-motion. See the full reference on the chart.animations page.
accessibility
Built-in accessibility features for keyboard navigation and screen-reader announcements. Enabled by default, no setup required.
enabled
trueMaster switch for all accessibility features. Set to false to opt out entirely.
description
undefinedA short text description of the chart that is announced to screen-reader users when the chart receives focus. Use this to summarize what the chart is showing (e.g. "Quarterly revenue 2024-2025, all four quarters above target").
announcements
enabled
trueWhen true, the chart emits live-region announcements as the user navigates between data points or series with the keyboard. Set to false to silence announcements while keeping keyboard navigation active.
keyboard
enabled
trueMaster switch for keyboard interactions. When true, the chart becomes focusable via Tab and exposes data points to assistive technology.
dataReducer
Downsamples large datasets before rendering so charts stay smooth with tens of thousands of points. Uses the LTTB (Largest-Triangle-Three-Buckets) algorithm, which preserves the visual shape of the series: peaks, troughs and trend changes are retained while redundant flat regions are thinned out.
Only kicks in when the series length exceeds threshold. Series below the threshold are rendered untouched.
chart: {
dataReducer: {
enabled: true,
algorithm: 'lttb',
targetPoints: 500,
threshold: 2000
}
}
The strategy adapts to the series type. Scalar line and area series use LTTB. Range series (rangeArea, rangeBar) and candlestick/OHLC series are downsampled with min-max bucket aggregation instead, which keeps each bucket's extremes so highs and lows are not thinned away.
enabled
falseTurn data reduction on. Off by default.
algorithm
'lttb'Algorithm used for scalar line and area series. Currently only 'lttb' is supported. Range and candlestick series use extreme-preserving bucket aggregation regardless of this setting.
targetPoints
250Approximate number of points to keep per series after reduction. Defaults to 250. Higher values preserve more detail at the cost of render time.
threshold
500Minimum series length before reduction kicks in. Series shorter than this are rendered without downsampling. Defaults to 500.
brush
enabled
falseTurn on this option to enable brush chart options. After you enable brush, you need to set target chart ID to allow the brush chart to capture events on the target chart.
target
undefinedChart ID of the target chart to sync the brush chart and the target chart. If you have an array of multiple chart IDs, use targets property instead.
autoScaleYaxis
trueIf set to true, the Y-axis will automatically scale based on the visible min/max range.
Note: One important configuration to set in a brush chart is the chart.selection option. The range which you set in chart.selection will act as brush in the brush chart
Here's an example code snippet how brush/target works
var targetChartOptions = {
chart: {
id: 'target-chart',
type: 'line',
height: 230,
toolbar: {
autoSelected: 'pan',
show: false
}
},
}
var brushChartOptions = {
chart: {
height: 130,
type: 'area',
brush:{
target: 'chart2',
enabled: true
},
selection: {
xaxis: {
min: new Date('19 Jun 2017').getTime(),
max: new Date('14 Aug 2017').getTime()
}
},
},
}
And, here you will find a complete example of brush charts usage Brush chart demo.
events
Event callbacks for clicks, hovers, selection, zoom/scroll, and the mount/update lifecycle. See the full reference on the chart.events page.