John Fred John Fred - 1 year ago 225
jQuery Question

Highstock Trigger javascript when range selector button clicked

How would I get, say, an

alert("Don't touch me!")
to execute when I press the '2Week' button in the following fiddle:

Answer Source

You can catch the setExtremes event, check e.rangeSelectorButton.text and find a current button. Then call custom action.

   xAxis: {
     events: {
       setExtremes: function(e) {
        if (e.rangeSelectorButton.text === "2Weeks") {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download