简体   繁体   English

Highcharts-ng中的可点击数据标签?

[英]Clickable Data Labels in Highcharts-ng?

I'd like to add an angular ng-click event or onClick event to some pie charts I have in my Angular App. 我想将ng-click事件或onClick事件添加到Angular应用程序中的某些饼图中。 The pie chart looks like this: 饼图如下所示:

在此处输入图片说明

What I'd like to do is when I click on that text that it applies some filtering logic I have. 我想做的是,当我单击该文本时,它将应用我已有的一些过滤逻辑。

However adding an ng-click to the formatter in highcharts-ng such as: 但是,在highcharts-ng中向格式化程序添加ng-click,例如:

'<span ng-click="doSomething()"><b>' + this.point.name + '</b>: ' + Highcharts.numberFormat(this.percentage, 2) + '%</span>';

Does not work. 不起作用。

I'm not sure how to make the data labels clickable in highcharts-ng. 我不确定如何在highcharts-ng中使数据标签可点击。

I have looked through my code and run through the app multiple times and have determined it is actually not an issue with the data-labels. 我查看了我的代码并多次运行了该应用程序,并确定它实际上与数据标签无关。 There's a $timeout used when rendering the code that for some reason removes the clickability of the labels. 渲染代码时会使用$ timeout,由于某种原因,该代码会删除标签的可点击性。 Without the timeout, I can click on the labels. 没有超时,我可以单击标签。 However, it removes the this.percentage of the chart. 但是,它将删除图表的this.percentage。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM