apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.21k stars 19.6k forks source link

树图 配置leaves--label--formatter失效 #8534

Closed fwfm closed 4 years ago

fwfm commented 6 years ago

One-line summary [问题简述]

只有在配置系列下的label属性时,formatter才会生效,如果加在leaves--label内,没有任何效果。如果formatter直接加在系列下的label属性中时,树的根结点的值是undefined。

Version & Environment [版本及环境]

Expected behaviour [期望结果]

配置leaves--label的formatter生效

ECharts option [ECharts配置项]

option = {
   tooltip: {
            trigger: 'item',
            triggerOn: 'mousemove'
        },
        series: [
            {
                type: 'tree',

                data: [data],

                top: '1%',
                left: '7%',
                bottom: '1%',
                right: '20%',

                symbolSize: 7,

                label: {
                    normal: {
                        position: 'left',
                        verticalAlign: 'middle',
                        align: 'right',
                        fontSize: 9,
                        formatter: '{b}   {c}'
                    }
                },

                leaves: {
                    label: {
                        normal: {
                            position: 'right',
                            verticalAlign: 'middle',
                            align: 'left',
                            formatter: '{b}   {c}'
                        }
                    }
                },

                expandAndCollapse: true,
                animationDuration: 550,
                animationDurationUpdate: 750
            }
        ]
}

000

Other comments [其他信息]

deqingli commented 4 years ago

11385

deqingli commented 4 years ago

The value of the root is undefined because the root hasn't bee set any value and the following is work:

data: [{
    name: 'aaa',
    value: 111
}]