[Bug] visualMap error
Author: CaptainJonCreated Aug 7, 2025Updated Sep 25, 2026
Labelsbug
Version
5.6.0
Link to Minimal Reproduction
Steps to Reproduce
if i set visualMap as follows, everything is fine:
visualMap: [
{
type: 'piecewise',
show: true,
dimension: 1,
pieces: [
{
lte: 100,
color: 'green'
},
{
gt: 100,
lte: 200,
color: 'red'
},
{
gt: 200,
lte: 300,
color: 'green'
},
{
gt: 300,
lte: 400,
color: 'red'
},
{
gt: 400,
color: '#f00'
}
]
}
],but if i change it as follows, something went wrong: Cannot read properties of undefined (reading 'coord')
visualMap: [
{
type: 'piecewise',
show: true,
dimension: 1,
pieces: [
{
lte: 400,
color: 'green'
},
{
gt: 400,
color: '#f00'
}
]
}
]here is the series and xAxis config:
xAxis: {
boundaryGap: false,
data: ['岳阳', '长沙', '株洲', '湘潭', '怀化']
},
series: [
{
name: '总人口',
type: 'line',
itemStyle: {
shadowColor: 'rgba(0, 0, 0, 0.40)'
},
lineStyle: {
shadowColor: 'rgba(0, 0, 0, 0.40)'
},
data: [320, 530, 230, 550, 220]
}
]Current Behavior
there is no clue how we should write pieces area, it looks like if the length of pieces is less than 3, then the error above comes out.
Expected Behavior
it should work and the official document should tell users whether there are any restrictions to enable it
Environment
- OS: Windows 11
- Browser: Google Chrome 130+
- Framework: React 17+Source: apache/echarts