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
- Basic Properties
- Labels & Formatting
- Grid & Tick Marks
- Plot Bands & Lines
Core axis options from Example:
AxisOptions.ts: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:- Extremes
- Update Axis
- Plot Bands/Lines
- Add/Remove Axes
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 fromAxisOptions.ts:
Best Practices
When using multiple Y-axes, set
opposite: true on secondary axes to position them on the right side for better clarity.- Clarity - Always include descriptive axis titles
- Range - Set appropriate
minandmaxvalues to avoid misleading visualizations - Labels - Rotate labels when they overlap, or use
staggerLinesfor alternating positions - Performance - For datetime axes with large datasets, set
tickPixelIntervalto reduce tick count - Accessibility - Use contrasting colors for grid lines and ensure labels are readable
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