Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Selected state not correctly redrawn when updating map data with setOption #20502

Open
henrik-wolf opened this issue Nov 11, 2024 · 5 comments
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.

Comments

@henrik-wolf
Copy link

Version

5.5.1

Link to Minimal Reproduction

https://codepen.io/SupergGrobi/pen/YzmdOKW

Steps to Reproduce

  1. Select an area by clicking on it.
  2. click the "new data" button
  3. hover above one of the two areas

Current Behavior

when clicking the "new data" button (which updates the data.value field of every entry in the map series) while an area is selected, the new data is accurately updated for all areas, however, the state of the current selection is no longer shown, but re-appears when hovering over the dataseries.

Expected Behavior

the unselected areas are redrawn with the new colors and the selected area is drawn considering the styling for highlighted/selected datapoints. No hovering should be required to get to this state.

Environment

- OS:macOS Sonoma
- Browser: Chrome
- Framework: plain javascript as well as Vue@3

Any additional comments?

This behaviour seems to be connected to having the geo component explicitly present in the options. In my usecase, I need it explicitly, as I want to scatter some points into the same map later on (see the mwe). (although the behaviour in that case is not super smooth either)

Somehow, this seems to work with an svg map, as in this example: modified french beef map (which updates the data a second after each selection)

@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Nov 11, 2024
@helgasoft
Copy link

not-a-bug, scatter update on map works fine - Demo
Please close issue if problem solved.
Debug and "how to" questions are better posted on stackoverflow, where there are more volunteers to help.
🚩 Please follow Official posting guidelines (below).


The issue list is reserved exclusively for bug reports and feature requests.
For usage questions, please use the following resources:


@henrik-wolf
Copy link
Author

Scatter works fine. It is the update of the map series (id 0) which causes the problems. I remove the scatter from the mwe, to highlight the issue. (I had it in there to show that my use case can not be reformulated in terms of only a series, without the geo component)

@helgasoft
Copy link

If you update the map geometry, then you'll have to register it again with echarts.registerMap. Should work...

@henrik-wolf
Copy link
Author

I do not update the map geometry. I update the data from which the colors of each area are calculated. My whole problem is, that when I do this, the selected state of an area is not correctly redrawn.

image

@henrik-wolf henrik-wolf changed the title [Bug] incorrect behaviour when updating map data with setOption [Bug] Selected state not correctly redrawn when updating map data with setOption Nov 12, 2024
@henrik-wolf
Copy link
Author

After some more experimentation, there seems to be an inconsistency in the way svg map are handled compared to geojson maps. In this pen I set up two identical plots, the left one using the svg representation of some test data and the right one using the geojson representation.

When clicking an area in the left plot, the selection-highlighting is preserved when changing the data, while in the right plot, it isn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

2 participants