[英]Change sprite text dynamically on chart
Is there any way to change sprite text dynamically on a chart? 有什么方法可以动态更改图表上的精灵文本?
This is not working: 这不起作用:
this.lookupReference('chart').setText('Second Text');
Fiddle: https://fiddle.sencha.com/#view/editor&fiddle/1mij 小提琴: https : //fiddle.sencha.com/#view/editor&fiddle/1mij
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 这是你的分叉工作小提琴
The chart is made by a canvas, you can't get a specific "piece of the chart" and modify it, so you simply need to redraw the chart with the new text. 该图表是由画布制作的,您无法获得特定的“图表”并进行修改,因此您只需要用新的文本重新绘制图表即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.