kam*_*aci 4 javascript jquery highcharts
此图形上有一个标签:http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/combo/ label是"总计水果消费"
创建图表后,如何动态更改该句子?
PS:我试图设置标签和重绘图形但不起作用:http://jsfiddle.net/UXDqL/
有任何想法吗?
如果使用标签,可以使用渲染器text()然后使用变量来保留对象.如果你需要动态更新这个文本,只需要使用attr()函数和更新.
var title = chart.renderer.text('Total fruits consumption', 100, 90)
.css({
fontSize: '12px'
})
.add();
$('#btn').click(function(){
title.attr({
text:'newText'
});
});
Run Code Online (Sandbox Code Playgroud)
如果您想在绘图后更改它,只需对元素本身进行操作即可。使用 jquery 选择器就像这样简单:
// find me the tspan containing the specified text and change it to...
$("tspan:contains('Total fruit consumption')").text("Something New")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12227 次 |
| 最近记录: |