apache / apache/echarts

Add selected state style for toolbox magicType buttons

Open
#21,672 1 comment 0 reactions 0 assignees View on GitHub
new-feature pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### 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' // 未选中类型:灰色
}
}

Contributor guide

Open the contributing guide

Research direction

Start by locating the toolbox magicType implementation and its existing normal/emphasis icon-style handling. Trace how the active chart type is selected, then review nearby tests or examples if present. Done means the API supports distinct selected and unselected icon styles while preserving existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.