Skip to content

legend样式自定义 #6810

@chuhanan

Description

@chuhanan

One-line summary [问题简述]

我想实现下面的效果
img

  1. legend 图例的样式可以自定义,echarts 现在没找到
  2. 实现默认选中第一个显示状态(凸出)
  3. 切换的时候legend图例也会互相影响

请问我该怎么做, 谢谢!

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 3.7.2
  • Browser version [浏览器类型和版本]: google 58
  • OS Version [操作系统类型和版本]: mac

Expected behaviour [期望结果]

以上, 谢谢

ECharts option [ECharts配置项]

option = {
   title: {
        text: '天气情况统计',
        subtext: '虚构数据',
        top:200,
        right: 20
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        top: 'middle',
        itemWidth:10,
        itemHeight:10,
        selected:{'益州':true},
        selectedMode:true,
        right: 50,
        data: ['西凉', '益州','兖州','荆州','幽州']
    },
    
    series : [
        {
            type: 'pie',
            radius : ['30%', '50%'],
            center: ['40%', '50%'],
            selectedMode: 'single',
            data:[
                {
                    value:1548,
                    name: '幽州',
                    label: {
                        normal: {
                            backgroundColor: '#eee',
                            borderColor: '#777',
                            borderWidth: 1,
                            borderRadius: 4
                                
                            
                        }
                    }
                },
                {value:535, name: '荆州'},
                {value:510, name: '兖州'},
                {value:634, name: '益州'},
                {value:735, name: '西凉'}
            ],
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: true,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                }
            },
            itemStyle: {
                emphasis: {
                    shadowBlur: 20,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
}

Other comments [其他信息]

没有了,谢谢

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementstaleInactive for a long time. Will be closed in 7 days.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions