-
Notifications
You must be signed in to change notification settings - Fork 23
Highcharts Javascript events
Available in M Chart Highcharts Library v.1.3+
The M Chart Highcharts Library integrates with the M Chart v2.0 admin UI using the WordPress wp.hooks API. These hooks allow the Highcharts library plugin to replace the default Chart.js renderer and settings UI in the admin.
For front-end
render_start/render_doneCustomEvents (which also apply to Highcharts charts), see Javascript events.
The Highcharts Library hooks into this filter to render Highcharts charts in the admin preview panel instead of the default Chart.js renderer.
When the active library is Highcharts, the library plugin:
- Hides the default canvas element
- Creates a dedicated
.m-chart-highcharts-rendercontainer - Renders the chart via
Highcharts.chart() - Generates a PNG image in the render callback
- Calls
onComplete()when finished
You can also hook into m_chart.render_chart yourself to further modify chart rendering behavior. Return a Highcharts chart instance to claim rendering, or return false to fall through.
wp.hooks.addFilter(
'm_chart.render_chart',
'my-plugin',
function( instance, canvas, chartArgs, onComplete, existingInstance ) {
// return false to defer to existing renderer
return false;
}
);The Highcharts Library hooks into this filter to replace the default Chart.js settings panel with a Highcharts-specific settings UI (theme picker, decimal indicator, thousands separator, numeric symbols, etc.).
You can add your own wp.hooks.addFilter call at a higher priority if you need to further customize the settings component.
wp.hooks.addFilter(
'm_chart.settings_component',
'my-plugin',
function( SettingsComponent ) {
// wrap or replace the settings component
return SettingsComponent;
}
);User Documentation
- Libraries
- Types of charts
- Creating a chart
- Example charts
- Chart shortcode
- CSV importing/exporting
- Settings
- Themes
- Duplicating charts
Developer Documentation
Guides
Highcharts Library