Skip to main content

Chart Configuration and Structure

Highcharts charts are created by passing a configuration object to the chart constructor. Understanding the chart structure and configuration options is fundamental to creating effective visualizations.

Creating a Chart

The basic pattern for creating a Highcharts chart involves initializing it with a configuration object:

Chart Structure

Every Highcharts chart consists of several key components:
The chart object defines the chart type, dimensions, and rendering options.
Key Properties:
  • type - Default series type for the chart
  • renderTo - DOM element ID where chart renders
  • zoomType - Enable mouse zooming on x, y, or both axes
  • polar - Convert the chart to polar coordinates

Chart Methods

Once created, chart instances expose methods for dynamic updates:

Chart Types

Highcharts supports numerous chart types through the chart.type option:
The chart type can be set globally with chart.type or overridden per series with series.type.

Real-World Example

Here’s a complete chart configuration with multiple features:

Chart Options Interface

The complete TypeScript interface from ChartOptions.ts:
string
default:"line"
The default series type for the chart. Can be any of the chart type options.
number
An explicit width for the chart. By default, the chart adapts to the container element’s width.
number
An explicit height for the chart. If not set, the height is calculated from the offset height of the containing element.
ColorType
default:"#FFFFFF"
The background color for the chart area.
'x' | 'y' | 'xy'
Decides in what dimensions the user can zoom by dragging the mouse.
boolean
default:false
When true, cartesian charts like line, spline, area, and column are transformed into the polar coordinate system.
ChartEventsOptions
Event listeners for the chart. Events include: load, render, addSeries, click, selection.

Best Practices

Always specify a container element that exists in the DOM before initializing the chart. The chart will fail to render if the container doesn’t exist.
  1. Container Setup - Ensure your container element has defined dimensions
  2. Performance - Use chart.reflow() instead of recreating charts on resize
  3. Accessibility - Include descriptive titles and axis labels
  4. Responsive Design - Use the responsive options for mobile-friendly charts

Next Steps

Series Configuration

Learn about configuring data series

Axes

Configure chart axes and scales

Responsive Charts

Make charts responsive to screen size

Options

Explore all configuration options