0

This question is a follow up to In high chart how to add event for label click

Is there a way to make the total sum number (ie. 10,9, 11, 11, 8) as shown at http://jsfiddle.net/t07ok5v3/5/ clickable? (ie. add the same functionality to the "9" as the "Oranges" label). What if there is only one number per column at the top representing the sum? Column chart with some drawing The following code was the code given in the answer to add the label click.

chart.xAxis[0].labelGroup.element.childNodes.forEach(function(label)
{
    label.style.cursor = "pointer";
    label.onclick = function(){
    alert('You clicked on '+this.textContent);
    }
}

UPDATE: I have made the stackLabels all appear to be clickable (they now have cursor "pointer', see jsfiddle link below). Now I just need to add the actual functionality of the click event to the stackLabel. Can someone help me with this?

http://jsfiddle.net/w291/gc1fdd1v/

Note: I don't have access to jquery in the development environment I am using.

UPDATE 2: The answer to this other question seems to solve my problem [so far] (I will update the post with my solution if it works): Click event on clicking on the graph

cs_user2017
  • 127
  • 1
  • 2
  • 12

1 Answers1

1

For this purpose, you can use Custom Events plugin. It will allow you to add custom events on various elements like axis labels, legend, etc.

Plugin Reference:
https://www.highcharts.com/plugin-registry/single/15/Custom-Events

Example:
http://jsfiddle.net/trmks8p2/

pawel_d
  • 3,061
  • 1
  • 8
  • 13