【发布时间】:2020-11-13 02:13:55
【问题描述】:
我有这个jsfiddle,其中我添加了两个自定义stock-tools 注释,其中添加了circle 和rectangle 图标以及toggleAnnotations 的预定义高图按钮。
stockTools: {
gui: {
enabled: true,
buttons: ['oneAnnotation', 'twoAnnotation', 'toggleAnnotations'],
definitions: {
oneAnnotation: {
className: 'highcharts-one-annotation',
symbol: 'circle.svg'
},
twoAnnotation: {
className: 'highcharts-two-annotation',
symbol: 'rectangle.svg'
},
}
}
},
正如我们所看到的,在这个切换注释可见性的预定义按钮中,图标在按钮单击时发生变化。所以我想在我的自定义按钮中有同样的东西。我实际上需要一个自定义按钮(而不是上面示例中的两个),并且我想在用户单击它时更改其图标。所以我想在circle.svg 和rectangle.svg 图标之间切换。
对按钮的点击由部件管理:
navigation: {
bindings: {
oneAnnotation: {
className: 'highcharts-one-annotation',
init: function(e) {
alert("click on the circle annotation");
}
},
twoAnnotation: {
className: 'highcharts-two-annotation',
init: function(e) {
alert("click on the rectangle annotation");
}
}
}
},
【问题讨论】:
标签: javascript highcharts