apache / apache/echarts

[Feature] visualMap为折线图分段设置颜色并为每一段设置阴影/VisualMap sets colors for line chart segments and shadows for each segment

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

Description

### What problem does this feature solve?

visualMap为折线图分段设置颜色并为每一段设置阴影/VisualMap sets colors for line chart segments and shadows for each segment

### What does the proposed API look like?

我希望可以像这样配置,折线图线条下面显示为阴影/I hope it can be configured like this, with shadows displayed below the lines in the line chart
option = {
xAxis: {
axisTick: { show: true },
axisLabel: { show: true },
type: 'category',
data: ['1', '2', '3', '4', '5', '6', '7']
},
legend: { show: true },
yAxis: {
axisTick: { show: true },
axisLabel: { show: true },
type: 'value'
},
visualMap: {
type: 'piecewise',
show: false, // 不显示visualMap控制器
dimension: 0, // 基于x轴
pieces: [
{ min: 2, max: 5 }, // 2-5区间应用特殊样式
],
inRange: {
color: '#FF9900', // 线条颜色
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: 'rgba(255, 153, 0, 0.5)' },
{ offset: 1, color: 'rgba(255, 153, 0, 0.1)' }
]
}
}
},
outOfRange: {
color: '#5470C6', // 默认线条颜色
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{ offset: 0, color: 'rgba(84, 112, 198, 0.5)' },
{ offset: 1, color: 'rgba(84, 112, 198, 0.1)' }
]
}
}
}
},
series: [{
name: '数据线',
type: 'line',
data: [120, 200, 150, 80, 70, 110, 130],
symbol: 'none',
lineStyle: {
width: 3
},
areaStyle: {} // 这里留空,由visualMap控制
}],
animationDuration: 1000
};

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.