Highcharts: Handling ng-click on tooltips

后端 未结 1 1775
悲&欢浪女
悲&欢浪女 2020-12-20 08:26

I need some help with a problem I am encountering. I created a chart and a custom tooltip, whenever the user clicks on the tooltip, it should call the $scope function.

相关标签:
1条回答
  • 2020-12-20 09:16

    Compile the tooltip element after the tooltip appears.

    In the pointFormatter return string:

    pointFormatter: function() {              
      return "<p style='color:red' ng-click='handleClick()'>Click here</p>"
    }
    

    In the click callback:

    events: {
      click: function(e) {
        tooltip.refresh(e.point, e);
        $compile(tooltip.label.div)(scope)
      }
    

    example: http://jsfiddle.net/mj9mj1n5/

    0 讨论(0)
提交回复
热议问题