我对 sencha touch 和 sencha touch charts 很陌生,在我的一个视图中集成图表时有点麻烦。我可能在这里遗漏了一些明显的东西。这是我设置chart
变量的方法。
var chart2 = new Ext.chart.Chart({
width: 500,
height: 300,
animate: true,
store: testStore,
theme: 'Base:gradients',
series: [{
type: 'pie',
angleField: 'data1',
label: {
field: 'name',
display: 'rotate',
contrast: true,
font: '18px Arial'
}
}]
});
一个简单的饼图加载其数据存储
var testStore = new Ext.data.JsonStore({
fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
data: [
{'name':'metric one', 'data1':10, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
{'name':'metric two', 'data1':7, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
{'name':'metric three', 'data1':5, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
{'name':'metric four', 'data1':2, 'data2':14, 'data3':6, 'data4':1, 'data5':23},
{'name':'metric five', 'data1':27, 'data2':38, 'data3':36, 'data4':13, 'data5':33}
]
});
这是我的ChartViewPanel
SS.views.chartView = Ext.extend(Ext.Panel, {
fullscreen: true,
initComponent: function() {
console.log("Initializing Chart View");
this.refreshButton = new Ext.Button({
text: 'Refresh',
ui: 'action',
handler: function() {
console.log("Refresh button is clicked");
},
scope: this
});
this.topToolbar = new Ext.Toolbar({
title: 'Chart View',
items: [
{ xtype: 'spacer'},
this.refreshButton
]
});
this.dockedItems = [this.topToolbar];
this.items = [chart2];
console.log(chart);
SS.views.chartView.superclass.initComponent.call(this);
}
});
顶部栏正在呈现,但不是图表。javascript 控制台也没有显示任何错误。我在什么时候出错了?非常感谢