#21672·echarts

Add selected state style for toolbox magicType buttons

Author: lingdang1007Created Jul 3, 2026Updated Sep 29, 2026
Labelsnew-featurepending

What problem does this feature solve?

目前 magicType 只有 normal 和 emphasis 两种状态 初始化时无法为默认选中的图标设置颜色,如果需要修改颜色只能所有的图标颜色都一起修改 无法为当前选中的类型设置不同颜色 希望能像 series 一样支持 selected 状态样式

What does the proposed API look like?

magicType: { type: ['line', 'bar'], // 每个类型的默认样式 iconStyle: { line: { color: '#0FBF98' }, // 折线图:绿色 bar: { color: '#333333' } // 柱状图:灰色 }, // 或者用 selected 状态 selectedIconStyle: { color: '#0FBF98' // 当前选中类型:绿色 }, normalIconStyle: { color: '#333333' // 未选中类型:灰色 } }