echarts设置饼状图的大小以及图形位置

来源:互联网 发布:mac上对u盘格式化 编辑:程序博客网 时间:2024/06/05 14:59
var ccbpie = {}; ccbpie.pie = function(text,divId,data){    require.config({paths : {echarts : getBaseURL() + '/js/echarts_news/dest'}});require([ 'echarts' ,'echarts/chart/pie','echarts/chart/funnel'], function(ec) {var myChart = ec.init(document.getElementById(divId));option = {   /* tooltip : {        trigger: 'item',         formatter: "{a} <br/>{b} : {c} ({d}%)"    },*/    legend: {    orient : 'vertical',    x : 10,    y : 100,        data:['新闻','微信','微博']    },    color:['#B0DC00','#8352BE','#F09252'],    toolbox: {        show : true,        feature : {            saveAsImage : {show: true}        }    },    calculable : false,    series : [        {            type:'pie',            radius : '70%',            center: ['55%', '55%'],            /*selectedMode: 'single',*/            itemStyle:{                 normal:{                       label:{                         show: true,                         formatter: '{b} : {c} ({d}%)' ,                        length:5                      },                       labelLine :{show:true}                     }                 },            data:[{value:eval('(' + data + ')')[0], name:'新闻',itemStyle: {                    normal: {                       label: { show: function () {                               if (eval('(' + data + ')')[0] == 0)                               { return false; }                           } ()                           },                           labelLine: { show: function () {                               if (eval('(' + data + ')')[0] == 0)                               { return false; }                           } ()                           }                    }                }},{value:eval('(' + data + ')')[1], name:'微信',itemStyle: {                    normal: {                       label: { show: function () {                               if (eval('(' + data + ')')[1] == 0)                               { return false; }                           } ()                           },                           labelLine: { show: function () {                               if (eval('(' + data + ')')[1] == 0)                               { return false; }                           } ()                           }                    }                }},{value:eval('(' + data + ')')[2], name:'微博',itemStyle: {                    normal: {                       label: { show: function () {                               if (eval('(' + data + ')')[2] == 0)                               { return false; }                           } ()                           },                           labelLine: { show: function () {                               if (eval('(' + data + ')')[2] == 0)                               { return false; }                           } ()                           }                    }                }},            ]        }    ]};myChart.setOption(option);});}

0 1
原创粉丝点击