echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] Multiple map series and visualMap objects not mapping as expected

Open amandamcvey opened this issue 1 year ago • 10 comments

Version

5.5.1

Link to Minimal Reproduction

https://codepen.io/amcveyCW/pen/OPLbpbd

Steps to Reproduce

  1. Add at least two series objects. Each should be of type 'map,' reference some map SVG, and include their own data array relating to the referenced map.
  2. Create a matching number of visualMap objects, either 'piecewise' or 'continuous' type. Set up some unique min/max/color/etc for each object. Each should include seriesIndex and the value should reference one of the corresponding series object created in the above step.
  3. Include legend for testing purposes.
  4. Note that the first visualMap object's seriesIndex is not respected and it controls both map series. By comparison, the following visualMap objects behave correctly and their seriesIndex is 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

amandamcvey avatar Dec 13 '24 20:12 amandamcvey

Why have two identical maps superimposed ? Usually one map is sufficient - Demo.

helgasoft avatar Dec 15 '24 17:12 helgasoft

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

Adarsh-Dhar avatar Dec 15 '24 23:12 Adarsh-Dhar

@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

amandamcvey avatar Dec 16 '24 15:12 amandamcvey

@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.

amandamcvey avatar Dec 16 '24 15:12 amandamcvey

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 avatar Dec 16 '24 23:12 helgasoft

@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

amandamcvey avatar Dec 17 '24 15:12 amandamcvey

@helgasoft here is an example using geo https://codepen.io/amcveyCW/pen/MYgJxaV

amandamcvey avatar Dec 17 '24 15:12 amandamcvey

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. image

helgasoft avatar Dec 17 '24 17:12 helgasoft

@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 avatar Dec 17 '24 17:12 amandamcvey

@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.

helgasoft avatar Dec 17 '24 19:12 helgasoft