简体   繁体   English

高图上下文按钮

[英]HighCharts Context Button

Is there any way to programmatically change a context button's text? 有什么办法以编程方式更改上下文按钮的文本? I've found that you can call the button's textContent within the actually element like so: 我发现您可以在实际元素内调用按钮的textContent ,如下所示:

$("#chart").highcharts().exportSVGElements[8].element.children[2].textContent = "Hello World"

However, this doesn't resize the button and kind of just seems like a work-around to something that may otherwise be readily available another way I see not documentation for. 但是,这并不能调整按钮的大小,而这似乎是一种解决方法,可以通过其他方式(我认为不是文档方式)容易地获得该功能。

Does anyone know if this can be done? 有谁知道这可以做到吗?

It can be changed easily during plugin initialization, like this: 可以在插件初始化期间轻松更改它,如下所示:

$("#container").highcharts({
   . 
   . 
   . 
   exporting : {
       buttons: { 
           contextButton: { 
               text: "Some text"
           }
       }
   }

Working example: http://jsfiddle.net/Gajotres/96sb2/ 工作示例: http : //jsfiddle.net/Gajotres/96sb2/

Update 更新

Dynamic change is possible but you will not like this solution. 可以进行动态更改,但您不会喜欢此解决方案。 Only way to dynamically change some Highcharts data is to destroy chart and redraw it again. 动态更改某些Highcharts数据的唯一方法是销毁图表并重新绘制。

Here's a working example: http://jsfiddle.net/Gajotres/96sb2/2/ 这是一个工作示例: http : //jsfiddle.net/Gajotres/96sb2/2/

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

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