score:39
If you want to add an event listener after the chart is already created, the documentation provides some insight regarding extending highcharts:
Events can be added to the instance through framework event binding. If your framework is jQuery, you can for example run
$(chart).bind('load', someFunction);
There is even some mention in the "Hooking up to Chart.init" section (on the same page) as to how you might bind an event after the chart has rendered, but it is a more invasive solution. I've adapted the code sample below with some modifications:
// General, global event listener
var globalCallback = function (chart) {
// Specific event listener
Highcharts.addEvent(chart.container, 'click', function (e) {
e = chart.pointer.normalize();
console.log('Clicked chart at ' + e.chartX + ', ' + e.chartY );
});
// Specific event listener
Highcharts.addEvent(chart.xAxis[0], 'afterSetExtremes', function (e) {
console.log('Set extremes to ' + e.min + ', ' + e.max);
});
}
// Add `globalCallback` to the list of highcharts callbacks
Highcharts.Chart.prototype.callbacks.push(globalCallback);
You can also take a look at their example JSFiddle for this scenario.
Source: stackoverflow.com
Related Query
- How do I add an event listener to a Highcharts object *AFTER* I've created it
- How to add series after click event in HighCharts
- how to get chart object inside a point event function in Highcharts
- How to add new points to highcharts after plotting the first 'n' points?
- How do i add mouse wheel code in Angular2 highcharts in typescript
- How to add different click events on each pie of a pie chart created by highcharts usin jquery
- how to add onclick event handler inside highcharts tooltip
- HighCharts : How to add click event on colorAxis in heatmap
- Link two series object in Highcharts and add event
- How to access React hook state in Highcharts event listener
- Highcharts how to add treemap upon click event on line chart?
- how to add copyright symbol in a highcharts title?
- Change Highcharts tooltip formatter from chart Object , after chart is rendered
- Highcharts : Chart with drilldown how to obtain click event of drill up button
- highcharts how to catch and insert logic in click reset zoom button event
- In high chart how to add event for label click
- How to add image in Highcharts Title and subtitle
- How to pass custom data into Highcharts graph click event
- How to add Highcharts on UIWebView in iOS?
- how to add annotation text to a Highcharts chart?
- How to add space between chart and axis in highcharts
- How to add secondary y-axis to highcharts
- How to add a label above each bar in HighCharts
- How to add an item to Highcharts legend?
- Add onclick event on chart made with the highcharts library
- Add highcharts plotband after render in R shiny/rcharts
- How to hide Axes Crosshairs by onclick event in Highcharts
- How to add background colors to category groupings in Highcharts
- HighCharts : How to add or remove "chart context menu" from chart container?
- How to add point to the beginning of series, Highcharts
More Query from same tag
- HighCharts - problems with tickInterval and tickAmount
- how to show labels in right side in chart?
- HighCharts x-axis not displaying correctly
- rCharts shows limited functionality when used with Shiny 0.8.0.99
- Highcharts - Bubble chart - Proportional bubbles
- Defaults for Highcharts graphs
- Use variable radius from HighCharts
- alternative to deprecated Highcharts.each when using arrays within an array
- Locate a dot with the same xpath in a highchart
- highcharts: there are no data in exported image
- How can I make Highcharts label a datetime X-axis with relative dates?
- Conflict between Highcharts and JQuery 1.8.2
- Highcharts - three series using left Y axis and the fourth using the right Y axis
- How to change one point color on click in Highcharts
- Angular-highcharts pushing data from api into highchart option
- Hide axis and gridlines Highcharts
- Highcharts pie chart annotations are not centering
- Highchart drawing issue
- Hightcharts Avoid "jump effect" on tooltip with "shared:true"
- How to force a line break without using <br/>
- Highcharts (ng2-highcharts) gauge in Ionic
- Adding dynamic mean to time series chart
- Passing data to Horizontal Bar Highchart.js showing only one record in codeigniter
- Filtering legend of a Highcharts by only visible series
- Dynamically feeding the column based highcharts from json assosiative array in jquery?
- How to set datalabels as vertical in Highcharts
- Creating array from javascript object
- Highcharts - Automatic min/max range is not set correctly for 'area' and 'column' fill types
- Multiple series in highstocks
- Creating a Highchart with multiple series from a JSON file