Version
5.4.3
Link to Minimal Reproduction
Steps to Reproduce
visualMap piecewise encoding for categories does not work for series type 'map'
myChart.showLoading();
$.get(ROOT_PATH + '/data/asset/geo/USA.json', function (usaJson) {
myChart.hideLoading();
echarts.registerMap('USA', usaJson, {
Alaska: {
left: -131,
top: 25,
width: 15
},
Hawaii: {
left: -110,
top: 28,
width: 5
},
'Puerto Rico': {
left: -76,
top: 26,
width: 2
}
});
option = {
title: {
text: 'USA Population Estimates (2012)',
subtext: 'Data from www.census.gov',
sublink: 'http://www.census.gov/popest/data/datasets.html',
left: 'right'
},
tooltip: {
trigger: 'item',
showDelay: 0,
transitionDuration: 0.2
},
visualMap: {
type: 'piecewise',
left: 'left',
categories: ['Apples', 'Oranges', 'Pears']
},
series: [
{
name: 'USA PopEstimates',
type: 'map',
roam: true,
map: 'USA',
emphasis: {
label: {
show: true
}
},
data: [
{ name: 'Alabama', value: 'Apples' },
{ name: 'Alaska', value: 'Oranges' },
{ name: 'Texas', value: 'Pears' }
]
}
]
};
myChart.setOption(option);
});```
### Current Behavior
The chart does not render any colours on the map (not even the basic colour for elements with no data)
### Expected Behavior
States with categories (in the above case: Alabama, Alaska, Texas) should be coloured on the map into their corresponding piecewise categories of 'Apples', 'Oranges', 'Pears'.
### Environment
```markdown
Latest Chrome and Edge
Any additional comments?
No response
1条答案
按热度按时间3mpgtkmj1#
There are problems with visualMap piecewise categories:
But if above is taken into account, then it works - Demo Code .