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);
});
the chart does not render any colours on the map (not even the basic colour for elements with no data)
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'.
Version
5.4.3
Link to Minimal Reproduction
https://echarts.apache.org/examples/en/editor.html?code=LYTwwgFghgTgLgOgM4QPYHcAyqoBMCWAdgOYAUAlANwBQAJAsQKZykBKA8uwCoD6ACgEEuACQAEAalEByAPS4ocKDKhIkzGU1QyAqgGUBCAFZJUhKQBpRAMwCuhAMZx8p0aRtIoAKROFyogN7UoqKgkLCIEPi4jNh4RGRUQaKM9tDwSAgwjMT4SHCMMACyUAAOpFJ6Ahai7l4-loHBwQIANioA1lAAXAFJTaItjFZwPQC0AIwAzOPmfU1wqCU9AEwArLP9wehRcBA946tzAL4bTcJQ6FD4-D2Nm4PDY-PjAAyn_QtLossAHO9N21wux6h36JzmUj4NgKC1ErHw9lQUluc2CDxGolGAHYAGz_YKfFZ41GiQHA77HJJHRLBRZOFwAXl6H3wcEGKM2onyAA8MRV9KI-IsbG16YRRABRPL4YAKRhIVzLF7jZbkCwkpA2ABGPL5ABEFFBrDBUMBSeh0Ah7IxCJqMsRUAA3dWczValpEdo9KQQOBwJYyGQWy3W23uBhOmQlRbyuByQ3xxRqOAZX3AFou-5DPkwfDEX1SY7_BaoFpOL53D654hMGDe1mMYCZ_ooDB6xhtEA9N4kuAwKC21nOQh6mz9sXdhDLItzR25GxQFrFCu9kAlRjekr4FKMbZqZtNdHe9EH4L2OUO3PynoAbSkAhKJUGSGqUnY_ZI8tffEYsBfAF0ZxbAptyQW8SUrTZCCgYAN2kSpBUWKUnFlfIX3xeY1zgqRZRKU8mhNGCej7aEMOCXDvUqfDgkbEpoCQXIOU5Q8oC1DsmOYppW3QYiYGhEkwQE0RwU4-RFHAzjgn8URoNg71WlYmCoGqR1F2heTH2fKRhLIpppNk7CFKQToVLU7D3wHJgXx0oSpJkmDsK4RhuRUUyWnU6Qfz_bSjiEwDOV8_p_OEmhyPANJEGTdgSjFUg6WHRJqUoIA
Steps to Reproduce
visualMap piecewise encoding for categories does not work for series type 'map'
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
Any additional comments?
No response