[Bug] Multiple map series and visualMap objects not mapping as expected
Version
5.5.1
Link to Minimal Reproduction
https://codepen.io/amcveyCW/pen/OPLbpbd
Steps to Reproduce
- Add at least two
seriesobjects. Each should be oftype'map,' reference some map SVG, and include their own data array relating to the referenced map. - Create a matching number of
visualMapobjects, either 'piecewise' or 'continuous'type. Set up some unique min/max/color/etc for each object. Each should includeseriesIndexand the value should reference one of the correspondingseriesobject created in the above step. - Include
legendfor testing purposes. - Note that the first
visualMapobject'sseriesIndexis not respected and it controls both map series. By comparison, the followingvisualMapobjects behave correctly and theirseriesIndexis respected. This is visible when the first map (A) is deselected from the legend.
Current Behavior
The first visualMap object thresholds and colors are applied to all series objects. If type 'continuous' - the following series objects are mapped to the first visualMap's 'max' color. If type 'piecewise' - the following series objects are mapped to the first visualMap object's 'outofrange' color.
Expected Behavior
Each series object to map to its corresponding visualMap object when referenced using the related seriesIndex and depict the threshold colors of that visualMap object.
Environment
No response
Any additional comments?
Both continuous and piecewise examples: https://codepen.io/amcveyCW/pen/OPLbpbd https://codepen.io/amcveyCW/pen/QwLGpdL
NOTE: One visualMap is not sufficient in my case where I have two separate regions that map to two different metrics. Imagine an image of a radiator and a fan - the radiator is mapped to a temperature value while the fan is mapped to a speed value.
NOTE: Using geo and geoIndex is an alternative that does not cause superimposed maps. https://codepen.io/amcveyCW/pen/MYgJxaV
Why have two identical maps superimposed ? Usually one map is sufficient - Demo.
Hey @amandamcvey I am not sure what functionality you are looking for but its currently works if you remove the series index but still the the mappings of the first visual map is still showing in the second one
https://echarts.apache.org/examples/en/editor.html?c=gauge-grade&code=PYBwLglsB2AEC8sDeAoW6OfWYwA2kIAXMmluZmAE4QDmtAplSQOQRgMC2LZFGAvgBpefWAGcmEBmJIBtEaIypFi6AENODVgEEWwlaLABPEFtgtOakHoUGMl4uYDuwKngAmNuxXdqwauVtvTCR1TVYAVWh2BndYAGV_DjE9WAA3NTwAVzMARgAGfKEg4PRQjTMWAGE1dV9UjOyzACZC_hKDAF0OimLS5VKMMMqAIS9B7BNKh3GJh1YXN099Cdhff0DVrHLw8yqACwh1BsyckgBmNpWtsuHWAElodwg1E6aSABY2nsVu0vautdRGkIGIspkALJWTbBAZzI4kfJA0qWAAeJFaSJ-oiOACVaowSHCbgBjfCuOQsADEAFZ8mpzgAjV6CcxUhhqEkAdnOADZUtT3ABOD4MGmeP6rPqrEmZElZPBqRl4MzUHLYzDS7zElEI2BYrZoz6FZHBFUAMzARAARHSAKTW03ePEEsw6mXk5iwWSCkVi5ZsjncvkC2n0pmvSUTLWDWV4eWK5Wqqjq_7YqNYfgAbiAA
@helgasoft Hi! Unfortunately one visualMap is not sufficient in my case. I have two separate regions that map to two different data points. Imagine an image of a radiator and a fan - the radiator is mapped to a temperature value while the fan is mapped to a speed value. Can't use the same visualMap in this case
@Adarsh-Dhar Hi! unfortunately your example does not work as expected if both series are mapped to the second visualMap object. This can be confirmed by using the slider of the second visualMap.
I seriously doubt ECharts allows more than a single map on a chart. Simple experiment is to set a different center on each map. And with a single series there couldn't be more than a single visualMap.
@helgasoft i wrote this issue to only include the bare minimum amount of code needed to show the bug per the bug report requirements, but if the superimposed map is an issue - using geo and geoIndex is an alternative that does not cause multiple map figures. I will create and post an example
@helgasoft here is an example using geo https://codepen.io/amcveyCW/pen/MYgJxaV
I think your last example is a good illustration of the bug. There are two map series defined, but their data is auto-merged into one (=bug!). The first visualMap controls it. The second visualMap controls nothing since there is no second map. Documentation should be updated to say "Only one map series allowed without geo defined. And each geo area is limited to only one map series".
OTOH, using geo is a good idea - geo acts like grid and we can have multiple geo areas superimposed - Demo.
Unfortunately roam will not work correctly, which makes the map static.
@helgasoft Your multiple geo solution should work for me, luckily I do not currently need roam. Thank you! Regardless of echart's intention, why is the 'auto-merge into one' not the case for my first two examples, ie. the examples that do not use geo? Or rather is it that they were not good examples of the bug?
@amandamcvey, thank you for not giving up :-)
My assumption of "auto-merge" was wrong. By adding legend:{} to your initial examples it becomes obvious that multiple maps are indeed created, data is not "merged". I was fooled by the final chart behavior.
Now I think the bug is in seriesIndex of the first visualMap. Parameter seriesIndex:0 is not respected and the first visualMap controls both map series. By comparison, the second visualMap behaves correctly and seriesIndex:1 is respected. Visible when the first map (A) is deselected from the legend.