When to Use XY Charts
Use XY charts when you need to:- Display data on horizontal and vertical axes
- Show trends over time or categories
- Compare multiple data series
- Visualize relationships between variables
- Create column, line, area, or candlestick charts
Creating an XY Chart
Here’s a complete example showing how to create an XY chart with a line series:Configuration Options
Pan and Zoom
Control user interaction with the chart using pan and zoom settings.
- panX (
boolean) - Enable horizontal panning by dragging - panY (
boolean) - Enable vertical panning by dragging - wheelX - Mouse wheel behavior for horizontal scrolling (“zoomX” | “zoomY” | “zoomXY” | “panX” | “panY” | “panXY” | “none”)
- wheelY - Mouse wheel behavior for vertical scrolling
- pinchZoomX (
boolean) - Enable pinch zoom horizontally on touch devices - pinchZoomY (
boolean) - Enable pinch zoom vertically on touch devices
Scrollbars
Add scrollbars for easier navigation:Cursor
Display crosshair cursor for better data tracking:Tooltips
Control tooltip display behavior:- maxTooltipDistance (
number) - Maximum pixel distance for tooltip clustering - maxTooltipDistanceBy (“xy” | “x” | “y”) - How to measure tooltip distance
- arrangeTooltips (
boolean) - Auto-arrange tooltips to prevent overlap
Key Classes
XYChart- Main chart class from@amcharts/amcharts5/xyDateAxis/CategoryAxis/ValueAxis- Axis typesLineSeries/ColumnSeries/CandlestickSeries- Series typesXYCursor- Interactive cursorScrollbar- Navigation scrollbar
Common Series Types
- Line Series - Connect data points with lines
- Column Series - Display data as vertical bars
- Area Series - Fill area under line
- Candlestick Series - Financial OHLC charts
- Step Line Series - Step-wise line connections