Search code examples
angularjspie-chartecharts

Echarts 3.6.2 Legend Type "scroll" does not be applied correctly


In my angularJs project,I have a pie Echarts and I define it like below.The problem is that I may have lots of legend and I see I can use type:'scroll' to make it from here, but I failed and it has no impact.

$scope.pieEcharts1 = {
                option: {
                    title: {
                        text: 'MyPieChart',
                        left: 'left',
                    },
                    tooltip: {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient: 'vertical',
                        left: 'right',
                        type:'scroll',//does not work
                        data: []
                    },
                    label: {
                        normal: {
                            show: true,
                            formatter: '{d}%'
                        }
                    },
                    labelLine: {
                        normal: {
                            show: true
                        }
                    },
                    series: [{
                        name: 'MyData',
                        type: 'pie',
                        radius: '62%',
                        center: ['50%', '50%'],
                        data: [],
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }]
                }
            }
        }
//http request to get data
$scope.pieEcharts1.option.legend.data = nameArray
$scope.pieEcharts1.option.series[0] = dataArray

What is the problem in my code?


Solution

  • The scrollable legned is supported from v3.7.0.

    https://echarts.apache.org/zh/changelog.html#v3-7-0