apache / echarts

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

The returned value of pieselectchange missing attribute 'seriesId' #9830

Closed kazehaiya closed 5 years ago

kazehaiya commented 5 years ago

General Questions

I tried to get Pie's seriesId with pieselectchange funciton while Pie's data is more than two, howerer, I suppose the result is

{
    type: 'pieselected',
    // 系列 ID,可以在 option 中传入
    seriesId: string
    // 数据名称
    name: name,
    // 所有数据的选中状态表。
    selected: Object
}

but I get only

{
    type: 'pieselected',
    // 数据名称
    name: name,
    // 所有数据的选中状态表。
    selected: Object
}

And my series data is

series: [
    {
          name: 'A',
          id: '123',
          center: [90, '101px'],
          radius: [0, '80px'],
          data: [
            { name: 'A1', value: 30 },
            { name: 'A2', value: 60 },
            { name: 'A3', value: 90 }
          ]
        },
        {
          name: 'B',
          id: '12',
          center: [298, '101px'],
          radius: [0, '80px'],
          data: [
            { name: 'A1', value: 30 },
            { name: 'A2', value: 60 },
            { name: 'A3', value: 90 }
          ]
        }
]

Issue Type

Issue Details

The result of pieselectchange function missing seriesId params

Expected Behavior

As document's result

{
    type: 'pieselected',
    // 系列 ID,可以在 option 中传入
    seriesId: string
    // 数据名称
    name: name,
    // 所有数据的选中状态表。
    selected: Object
}

Current Behavior

Missing seriesId { type: 'pieselected', // 数据名称 name: name, // 所有数据的选中状态表。 selected: Object }

Online Example

Topics

Anything Else We Need to Know

Environment

Vue + vue-echarts + echarts

Ovilia commented 5 years ago

Test example:

var chart = echarts.init(document.getElementById('main'), null, {
    renderer: 'svg'
});
var option = {
    title : {
        text: '某站点用户访问来源',
        subtext: '纯属虚构',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'left',
        data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']
    },
    series : [
        {
            id: 'aaa',
            name: '访问来源',
            type: 'pie',
            radius : '55%',
            center: ['50%', '60%'],
            selectedMode: 'single',
            data:[
                {value:335, name:'直接访问'},
                {value:310, name:'邮件营销'},
                {value:234, name:'联盟广告'},
                {value:135, name:'视频广告'},
                {value:1548, name:'搜索引擎'}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};
chart.setOption(option, true);

chart.on('pieselectchanged', data => {
    console.log(data);
});