Extjs中动态改变FusionChart的图表类型

Extjs中使用图表FusionChart,图表的类型在定义Ext.ux.Chart.Fusion.Panel时,通过属性chartURL来设置图表类型,例如:
var fusionPanel=new Ext.ux.Chart.Fusion.Panel({
collapsible:false,
chartCfg:{
id:'chart1',
params:{
flashVars:{
debugMode:0,
lang:'EN'
}
}
},
autoScroll:true,
loadMask:true,
mediaMask:true,
id:'chartpanel',
chartURL:'charts/Pie3D.swf', //定义图表类型
dataXML:strXml,
width:500,
height:310
...
如果在图表显示之后,需要变更图表类型,笔者查看了uxfusion.js,没有发现类似setChartUrl功能的函数,通过摸索,可以自行增加类似函数,实现动态变更图表类型的:
代码(uxfusion.js中增加):
setChartData : function(xml, immediate){
                 var o;
                 this.chartData = xml;
                 this.dataURL = null;
                 
                 if( immediate !== false && (o = this.getInterface())){

                      if( 'setDataXML' in o ){
                             o.setDataXML(xml);
                      } else { //FC Free Interface
                             this.setVariable("_root.dataURL","");
                             //Set the flag
                             this.setVariable("_root.isNewData","1");
                               //Set the actual data
                             this.setVariable("_root.newData",xml);
                             //Go to the required frame
                             if('TGotoLabel' in o){
                                   o.TGotoLabel("/", "JavaScriptHandler");
                             }
                      }
                 }
                 o = null;
                 return this;
             },
            setChartUrl : function(Url){   //增加变更图表类型的函数,哈哈简单吧
           this.chartURL = Url;
           this.refreshMedia();
           
        },
...
使用方法就很简单了,举例:
{
text:'饼形',
handler:function(){fusionPanel.setChartUrl('charts/Pie3D.swf');}
}
Extjs中动态改变FusionChart的图表类型



Extjs中动态改变FusionChart的图表类型
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值