Echarts 饼图不显示

xxxt 发布于 2014/09/24 09:03
阅读 3K+
收藏 0

饼图没有显示 只有legend显示,以前可以,后来不知道改了哪里就不行了

  var option = {
                    title : {
                        text : '',
                        x    :'center'
                    },
                    backgroundColor : {
                        color : '#ffffff'
                    },
                    tooltip : {
                        trigger   : 'item',
                        formatter : "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient : 'vertical',
                        x      : 'left',
                        data   : []
                    },
                    toolbox: {
                        show    : true,
                        feature : {
                            dataView : {show: true, readOnly: false},
                            restore  : {show: true}
                        }
                    },
                    calculable : true,
                    series : [
                        {
                            name   : '桥梁统计',
                            type   : 'pie',
                            radius : '55%',
                            center : ['50%', '60%'],
                            data   : []
                        }
                    ]
                };

 $.ajax({
                url        : "/dzdt/rest/ql/tjjg",
                data       : "xzqhbm="+qlxzqhbm+"&szlx="+qlszlx+'&type='+qltype,
                type       : 'get',
                cache      : false,
                async        : false,
                dataType   : 'json',
                beforeSend : function() {
                    myChart.showLoading({
                        text: '正在努力的读取数据中...',
                    });
                    myChart2.showLoading({
                        text: '正在努力的读取数据中...',
                    });
                },
                success    : function(obj) {
                    myChart.hideLoading();
                    myChart2.hideLoading();
                    option.title.text = obj.chartsText;
                    option.legend.data = obj.legendData;
                    option.series[0].data = obj.seriesData;
                    myChart.setOption(option);
                    console.log(obj.seriesData);
                    option.series[0].data = obj.seriesLengthData;
                    console.log(obj.seriesLengthData);
                    myChart2.setOption(option);
                    console.log(myChart);
                },
                error : function() {
                    myChart.hideLoading();
                    myChart2.hideLoading();
                }
            });

数据

控制台myChart对象 部分属性(legend,series)

显示效果

加载中
返回顶部
顶部