[英]ExtJS gauge chart series - setValue() is not a function
I have a piece of code looking like this: 我有一段代码看起来像这样:
var myChart = this.items[i].items[j].down().down();
myChart.series.items[0].setValue(30);
myChart is well defined. myChart定义明确。 When I spy it in firebug, it contains the chart.
当我在萤火虫中监视它时,它包含图表。
I understood that gauge is not a type of chart but a type of series, so I really don't understand why I get the error "setValue is not a function" ! 我知道仪表不是图表的类型而是系列的类型,所以我真的不明白为什么会出现错误“ setValue is a function”!
If someone could help, it would be really cool cause I'm very annoyed with that. 如果有人可以提供帮助,那将真的很酷,因为我对此感到非常恼火。
Here's my view definition: 这是我的视图定义:
Ext.define('MyApp.view.portlet.GaugePortlet', {
extend: 'Ext.panel.Panel',
alias: 'widget.gaugeportlet',
height: 300,
requires: [
'Ext.data.JsonStore',
'Ext.chart.theme.Base',
'Ext.chart.series.Series',
'Ext.chart.series.Line',
'Ext.chart.axis.Numeric',
'Ext.chart.*',
'Ext.chart.axis.Gauge',
'Ext.chart.series.*'],
initComponent: function () {
Ext.apply(this, {
layout: 'fit',
items: {
xtype: 'chart',
animate: {
easing: 'elasticIn',
duration: 1000
},
legend: {
position: 'bottom'
},
axes: [{
type: 'gauge',
position: 'gauge',
minimum: 0,
maximum: 2,
steps: 10
}],
series: [{
type: 'gauge',
donut: false,
colorSet: ['#F49D10', '#ddd']
}]
}
});
this.callParent(arguments);
}
});
I don't want to work with dynamic stores for now, I just want to test with setting an hardcoded value. 我现在不想使用动态存储,我只想测试设置硬编码的值。
Thanks 谢谢
I finally fixed this error by using setValue in my view's afterLayout event. 我终于通过在视图的afterLayout事件中使用setValue修复了此错误。
So my code looks like this now: 所以我的代码现在看起来像这样:
//view declaration...
listeners:
{
afterlayout: function ()
{
//use setValue here.
}
}
Finally I'm facing an other issue... I have no more error in firebug but visually, my gauge chart is not displaying any value. 最终,我面临着另一个问题……萤火虫中没有更多错误,但是从视觉上看,我的仪表图没有显示任何值。 It is well rendered, but it is empty.... I tried to update it using the doLayout() or doComponentLayout() methods, but still nothing happens.
它呈现的很好,但是它是空的。...我尝试使用doLayout()或doComponentLayout()方法对其进行更新,但是仍然没有任何反应。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.