echarts在执行两次回调函数的时候,回调返回的数据不一样,这个怎么做

xiaoh3 发布于 2014/06/25 15:33
阅读 676
收藏 0
series : [
                    {
                        name: '世界',
                        type: 'map',
                        mapType: 'world',
                        //selectedMode : 'multiple',
                        roam: true,//     是否开启滚轮缩放和拖拽漫游    
                        hoverable: false,  
                       
                        data:[ {$WorldXML}(第一次回调函数)
                        ],
                        markLine : {
                            itemStyle : {
                                normal: {
                                    //color:'#A020F0',
                                    borderWidth:1
                                }
                            },
                            data : [
                                [{name:'中国'},{name:'美国'}],
                                [{name:'中国'},{name:'巴西'}],
                                [{name:'美国'},{name:'巴西'}](第二次回调函数)
                                
                            ]

                        },


在下边代码我该怎么处理,两次回调返回是数据不一样:

tooltip : {
                    trigger:  'item',
                    show:false,
                    formatter: function(a){
                        //console.log(a);
                        var sName = a[0];
                        var pName = a[1];
                        var obj = a[2];
                        if(obj=='-'){
                            //var value='';  
                            /* for(var kk in obj){
                                 console.log(kk+'=>'+obj[kk]);                           
                                //var value=obj[val];                        
                             };   */      
                      // return ;
                        }else{
                            var val='val';
                            for(var k in obj){
                                 //alert(k+'=>'+obj[k]);                           
                                var value=obj[val ];                        
                             };           
                        }
                                   
                        return   pName+'所占百分比为:'+value;
                    }},

加载中
返回顶部
顶部