[Feature] Need different color for each brush marker.
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### What problem does this feature solve?
Get different color for each brush area like given in the example below -

Right now we have option to set color for brush component but it is applicable for all brush.
We need feature to provide diff colors for each area.
Below is the code that we have tried for achieving above functionality.
function func(x) {
x /= 10;
return Math.random() * 22
}
function generateData() {
let data = [];
for (let i = 0; i <= 10; i += 0.1) {
data.push([i, func(i)]);
}
return data;
}
let colors = ['red', 'green','yellow', 'blue'];
option = {
animation: false,
toolbox: {
feature: {
dataZoom: {
yAxisIndex: false
},
brush: {
type: ['lineX', 'clear', 'keep']
},
}
},
brush: {
xAxisIndex: 'all',
brushLink: 'all',
brushStyle: {
color: 'white',
},
outOfBrush: {
colorAlpha: 0.1
}
},
graphic: {
elements: [],
},
grid: {
top: 100,
left: 50,
right: 40,
bottom: 50
},
xAxis: {
minorTick: {
show: true
},
minorSplitLine: {
show: true
}
},
yAxis: {
minorTick: {
show: true
},
minorSplitLine: {
show: true
}
},
series: [
{
type: 'line',
showSymbol: false,
clip: true,
data: generateData()
}
]
};
let count = 0;
myChart.on('brushEnd', function() {
let newOption = option;
newOption.brush.brushStyle.color = colors[count],
count = count + 1;
myChart.setOption(newOption);
})
### What does the proposed API look like?
NaN
Contributor guide
Assessment
This issue has not been assessed yet.