有什么方法可以动态更改图表上的 Sprite 文本吗?
这不起作用:
this.lookupReference('chart').setText('Second Text');
最佳答案
handler: function(){
var chart=this.next();
chart.setSprites({
type: 'text',
reference: 'sprites',
text: 'Second text ',
font: '13px Helvetica bold',
width: 100,
height: 30,
x: 50, // the sprite x position
y: 17 // the sprite y position
});
chart.redraw();
}
here is your forked working fiddle
图表是由 Canvas 制作的,您无法获取特定的“图表片段”并对其进行修改,因此您只需使用新文本重新绘制图表即可。
关于javascript - 动态更改图表上的 Sprite 文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41150631/