点击相应按钮改变图表的类型,请问怎样获取到Chart.series.type这的属性值并改变它,部分代码如下:
Ext.onReady(function(){
var data = [{name:'Jan',value:20},{name:'Feb',value:25},{name:'Mat',value:45},{name:'Apr',value:38},{name:'Oct',value:30}];
var store = Ext.create('Ext.data.Store',{fields:['name','value'],data:data}); //Ext.create实例化方法 var chart = Ext.create('Ext.chart.Chart',{
id:"chartID",
width:500,//宽度
height:300,//高度
store:store,//设置数据源
//renderTo:Ext.getBody(),
legend:{position:'bottom'},//图例
//设置坐标轴属性
axes:[{……}],
//设置曲线属性
series:[{type:'line',//折线图
axis:'left',
xField:'name',
yField:'value',
erCfg:{size:5,radius:5
},
tips:{width:100,height:60,renderer:function(storeItem, item){
this.setTitle(storeItem.get('name') +'<br/>'+ storeItem.get('value'));}}//setTitle(String title,String iconCls)
}]
});
Ext.get("btn1").on("click",function(){chart.series.type="line";});
Ext.onReady(function(){
var data = [{name:'Jan',value:20},{name:'Feb',value:25},{name:'Mat',value:45},{name:'Apr',value:38},{name:'Oct',value:30}];
var store = Ext.create('Ext.data.Store',{fields:['name','value'],data:data}); //Ext.create实例化方法 var chart = Ext.create('Ext.chart.Chart',{
id:"chartID",
width:500,//宽度
height:300,//高度
store:store,//设置数据源
//renderTo:Ext.getBody(),
legend:{position:'bottom'},//图例
//设置坐标轴属性
axes:[{……}],
//设置曲线属性
series:[{type:'line',//折线图
axis:'left',
xField:'name',
yField:'value',
erCfg:{size:5,radius:5
},
tips:{width:100,height:60,renderer:function(storeItem, item){
this.setTitle(storeItem.get('name') +'<br/>'+ storeItem.get('value'));}}//setTitle(String title,String iconCls)
}]
});
Ext.get("btn1").on("click",function(){chart.series.type="line";});
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货