Architecture Overview
Highcharts is built on a modular architecture where major concepts correspond to JavaScript classes:Highcharts.Chart- Main chart instanceHighcharts.Series- Series data and renderingHighcharts.Axis- Axis functionalityHighcharts.Tooltip- Tooltip displayHighcharts.Legend- Legend componentHighcharts.Pointer- Mouse/touch interaction
See the full class reference for all available classes.
Plugin Structure
All Highcharts plugins should follow this structure:Using addEvent
TheaddEvent utility allows you to listen to events on classes and instances.
Class-Level Events
Listen to events on all instances:Instance-Level Events
Listen to events on specific instances:Complete Example: Click Handler
Prefer regular functions over arrow functions when using
addEvent. Highcharts binds this to the runtime object, while arrow functions maintain lexical this.Wrapping Prototype Functions
Thewrap utility allows you to modify existing functionality:
Example: Custom Graph Drawing
Example: Custom Tooltip Formatting
Creating a Complete Plugin
Here’s a complete plugin that adds trackballs to column series:Extending with ES Modules
When using ES modules, you can access and modify modules directly:Creating Custom Series Types
Extend existing series types to create new ones:Accessing Internal APIs
Plugin Best Practices
1
Use IIFE Wrapper
2
Avoid Global Variables
3
Clean Up Resources
4
Document Your Plugin