Toggling export annotation mode

This demo shows how you can programatically toggle Export plugin's Annotation mode.

The following code is used to go in and out of annotation mode:

function toggleAnnotations() {
  if (chart["export"].drawing.enabled) {
    chart["export"].drawing.handler.done();
  }
  else {
    chart["export"].capture({
      "action": "draw"
    }, function() {
      var drawingMenu = chart["export"].config.menu[0].menu[2].menu;
      chart["export"].createMenu(drawingMenu);
    });
  }
}