饼状图注释

valuesChart: function(oData) {
            var valueArr=[];
            var detailArr=[];
            $.each(oData,function(idx,item){
                valueArr.push(item.senseName);
                detailArr.push({value:item.score,name:item.senseName});
            });
            var tChart = echarts.init($('.chart-box')[0]);
            var option = {
                color: ['#55B7BA', '#8c4be2', '#E82E83', '#0a76e0', '#FBAB1B'],
                legend: {//渲染示例
                    x: 'right',
                    left: '50%',
                    top: 'middle',
                    width: 120,
                    height: 520,
                    itemWidth: 8,//图例颜色的宽高
                    itemHeight: 8,
                    selectedMode: false,
                    data: valueArr
                },
                series: [{
                    name: '访问来源',
                    type: 'pie',
                    center: ['28%', '50%'],//位置
                    radius: ['65%', '80%'],//圆圈大小
                    avoidLabelOverlap: false,
                    //hoverAnimation: false,
                    label: {
                        normal: {//光标放上去后的效果
                            show: false,
                            position: 'center',
                        },
                        emphasis: {
                            show: true,//显示光标放上去后的示例
                            formatter: '{b}\n{d}',//强调效果
                        }
                    },
                    labelLine: {//示例引导线
                        normal: {
                            show: false
                        }
                    },
                    itemStyle: {//边框颜色
                        normal: {
                            borderColor: '#FFF'
                        },
                        emphasis: {
                            opacity: 0.5
                        }
                    },
                    data: detailArr
                }]
            };
            tChart.setOption(option);
            tChart.on('mouseover', function() {
                $(this.getDom()).prev().hide();
            });
            tChart.on('mouseout', function() {
                $(this.getDom()).prev().show();
            });
        }

 

posted @ 2017-01-10 11:02  小猪冒泡  阅读(523)  评论(0编辑  收藏  举报