Skip to main content

Axis Configuration

Axes are fundamental components of Highcharts that define the scale and position of data. Understanding axis configuration is essential for creating effective and accurate visualizations.

Axis Basics

Most Highcharts charts have two axes: the X-axis (horizontal) and Y-axis (vertical). Each axis can be configured independently.

Axis Configuration Options

Core axis options from AxisOptions.ts:
Example:

Axis Types

Highcharts supports four primary axis types:

Linear

Default numeric axis with linear scale

Logarithmic

Logarithmic scale for exponential data

DateTime

Time-based axis for temporal data

Category

Categorical axis for discrete values

Multiple Axes

Charts can have multiple X or Y axes to display different scales:

Axis Methods

Manipulate axes dynamically after chart creation:

Crosshair Configuration

Crosshairs help users identify exact values:

Real-World Examples

Axis Options Reference

string
default:"linear"
The type of axis: 'linear', 'logarithmic', 'datetime', or 'category'.
string[]
Array of category names for a category axis. Automatically sets type to 'category'.
number
The minimum value of the axis. If null, the min value is automatically calculated.
number
The maximum value of the axis. If null, the max value is automatically calculated.
boolean
default:false
Whether to reverse the axis so that the highest number is closest to the origin.
boolean
default:false
Whether to display the axis on the opposite side of the normal. The normal is on the left for vertical axes and bottom for horizontal axes.
number
The interval of the tick marks in axis units. When null, the tick interval is computed to approximately follow the tickPixelInterval.
number
default:0
The width of the grid lines extending from the axis across the gradient or plot area.
AxisLabelsOptions
Configuration for the axis labels, including formatting, rotation, and styling.
AxisTitleOptions
The axis title, displayed next to the axis line.
AxisCrosshairOptions | boolean
Configure a crosshair that follows the mouse pointer along the axis.

TypeScript Interface

Key axis interfaces from AxisOptions.ts:

Best Practices

When using multiple Y-axes, set opposite: true on secondary axes to position them on the right side for better clarity.
  1. Clarity - Always include descriptive axis titles
  2. Range - Set appropriate min and max values to avoid misleading visualizations
  3. Labels - Rotate labels when they overlap, or use staggerLines for alternating positions
  4. Performance - For datetime axes with large datasets, set tickPixelInterval to reduce tick count
  5. Accessibility - Use contrasting colors for grid lines and ensure labels are readable
Logarithmic axes cannot display zero or negative values. Ensure your data contains only positive numbers when using type: 'logarithmic'.

Next Steps

Data Handling

Learn about data formats and loading

Series Configuration

Configure data series

Responsive Charts

Make axes responsive to screen size

API Reference

Complete axis API documentation