Ext Js chart

对于一个ext菜鸟的学习者,首先想的是怎么入门。入门的基本模型要出来
创建chart表的步骤
Ext.define('aa',{
extend:'Ext.data.Model',
fields:['temp','date']
});
var store = Ext.create('Ext.data.Store',{
model:'aa',
data:[
{temp:12,date:1},
{temp:21,date:2},
{temp:33,date:3},
{temp:47,date:4}

]
});
Ext.create('Ext.chart.Chart',{
renderTo:Ext.getBody(),
width:300,
height:300,
store:store,
theme: 'Green',
axes:[
{
title:'temp',
type:'Numeric',
position:'left',
fields:['temp'],

},
{
title:'date',
type:'Category',
position:'bottom',
fields:['date'],
}
],
series:[{
type:'line',
xField:'date',
yField:'temp'
}
]

});

1.创建一个模型,表示将要显示在图标上的数据,如上aaModel
2.创建一个store
3.创建一个图标对象Ext.chart.Chart
4,配置轴,axes是定义图表数据点边界的线,例子中使用了常用的配置之一轴配置,x轴,y轴
5.配置序列。series是负责数据仓库中的数据点视觉呈现

猜你喜欢

转载自happygirlwang.iteye.com/blog/2294085