ComposedChart component allows you to combine multiple chart types (Line, Bar, Area, and Scatter) in a single chart. It’s useful for comparing different data series with different visualization styles.
Basic composed chart
Line and bar combination
Multiple Y axes
When using multiple Y axes, specify
yAxisId on both the axis and the chart elements to link them together.Area and line overlay
Stacked bars with line
With scatter plot
Vertical (horizontal layout)
With reference lines
Different data scales
Common pitfalls
- Y-axis mismatch: When combining elements with different value ranges, use separate Y axes with
yAxisIdto prevent scaling issues. - Z-index layering: Chart elements are rendered in the order they appear. Place areas first, then bars, then lines to prevent overlap issues.
- Tooltip event type: ComposedChart supports only
'axis'tooltip event type. - Mixed layouts: Don’t mix
layout="horizontal"bars withlayout="vertical"lines in the same chart.