blacklabel / annotations

Annotations plugin for Highstock by Black Label
http://blacklabel.github.io/annotations/
Other
22 stars 16 forks source link

Ability to toggle annotation buttons #75

Open samidabeast opened 7 years ago

samidabeast commented 7 years ago

Right now if I want to update the chart to not show the annotation buttons, it does not do anything. Can this be added?

Example of it not working with button calling chart.update(); http://jsfiddle.net/7ddsadLg/

pawelfus commented 7 years ago

Thank you for reporting!

At this moment, chart.update() doesn't change anything in the annotations plugin. Right now you can hide manually each button:

  chart.annotations.buttons.forEach(function (button) {
        button[0].hide();
  });

Demo: http://jsfiddle.net/7ddsadLg/1/

samidabeast commented 7 years ago

Thank you for the quick response. This workaround works. However, if you start the chart with the buttons not enabled, they never show up.

Example: http://jsfiddle.net/7ddsadLg/2/

pawelfus commented 7 years ago

This is correct, buttons must be rendered so we can hide them. You can use chart.events.load callback to hide them on init.