score:4
if you don't want to use jquery you can use it as follows
chart.xaxis[0].labelgroup.element.childnodes.foreach(function(label)
{
label.style.cursor = "pointer";
label.onclick = function(){
alert('you clicked on '+this.textcontent);
}
});
complete code at http://jsfiddle.net/t07ok5v3/5/
score:0
i get error: object doesn't support property or method 'foreach' when running the solution from malay sarkar in internet explorer. here's a workaround i used which works in both chrome and ie.
for (let i = 0; chart.xaxis[0].labelgroup.element.childnodes.length; i++)
{
chart.xaxis[0].labelgroup.element.childnodes[i].onclick = function(){
alert('you clicked on '+this.textcontent);
}
});
score:2
alternate solution, maintained since highcharts v3 is to use custom events plugin. plugin adds a lot of new event, natively not supported by highcharts.
demo: https://jsfiddle.net/blacklabel/utx8g/963/
events are added the same way as official events in highcharts, and we don't need to re-inspect every release the dom:
xaxis: {
labels: {
events: {
click: function () { ... }
}
}
}
Source: stackoverflow.com
Related Query
- In high chart how to add event for label click
- How to use click event on Y-axis label in angular Gantt chart High Chart
- How to call typescript function inside High chart click event
- How to use add series and update methods in the high chart wrapper for angular?
- Highcharts:add click event on data label for pie chart
- How to add click event on django-chatit chart
- How to change the label color of Y-Axis on click in angular Gantt chart High Chart
- Highcharts : Chart with drilldown how to obtain click event of drill up button
- Fire click event on a highchart column drilldown chart on clicking x axis for drill down reports
- HighCharts: How to Determine on Click Event what Data Grouping the Chart is Currently In?
- HighChart : plot line click event for multiple chart
- How to add series after click event in HighCharts
- HighCharts: How to display unique text for yAxis Label in a spline chart
- Highcharts: How to change or redraw a chart when a click event occurs on an another chart?
- How to use for loop array to add series dynamically for line chart
- How to add different click events on each pie of a pie chart created by highcharts usin jquery
- How can I use data.table or data.csv and extra data for click event handling
- High chart on click event listening
- Highcharts display label for pie chart using html table as data source
- x axis label word wrap in high charts for radar chart
- HighCharts : How to add click event on colorAxis in heatmap
- Detect a click on, and add hover/selected style for x axis on area chart in Highcharts?
- How to add negative area or background for a specific bar or pie chart in highcharts?
- React / High chart / Stacked bar label for each block
- How can I add double related x-axis bar to high chart in zoom
- how to limit the label size only for bubble diameter in high charts
- How to add different series data for each categories in Stacked Column chart in Highcharts?
- Highcharts - How to get the particular chart id on click of custom label in export options
- How to set individual colors for high chart pies
- Add X-Axis label click event on Angular 2 Highcharts
More Query from same tag
- Highchart Funnel for Angular
- Can we add Zoom In Out feature in highcharts
- Handle touch event on Apple - Highcharts
- Linking a Filter/Search Table to a Highchart
- Sorting Sankey chart's source & destination nodes alphabetically
- How to add the years in xAxis date format while exporting? Also how to add the data source during the exporting?
- Stacked highchart graph not working correctly for 0 values
- I can't use gauge-solid and spline chart at the same time by using HighCharts
- dotnet highchart error, not showing data
- Highchart javascript chart example not working
- high chart date format in x-axis
- Highcharts not tracking mouse activity under filled area
- HighChart response for time on yaxis and text on xaxis
- Change HighStock chart label on changing rangeselector button
- Getting data from Mysql for highstock area graph.
- Change data by download as pdf in Highcharts
- Highcharts footer spacing
- highchart funnel horizontal
- highcharts - to show a no data picture in case nothing to render from mysql query
- start at the same hour every day
- Change HighCharts plotLine-value and -label
- How make to fill space after column was hidden in column chart using highchart?
- Change zIndex in HighChart
- Plotting multiple points in highchart timeseries
- Binding "Highcharts" events in rails
- How to apply a gradient to a rectangle in Highcharts
- Label position between series in Highcharts polar chart
- How to import Proj4js to use with Highmaps?
- How to display bars next to each other
- Change size of legend symbol