apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
59.59k stars 19.58k forks source link

[Bug] Brush selection - missing most points after progressive re-render #19857

Open ilius33 opened 2 months ago

ilius33 commented 2 months ago

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=scatter-large&code=GYVwdgxgLglg9mABAcwKZgCIEMpYBQA26ANInMMAM6pQCUiA3gFCKJFSJYBOXiAvIjCoA7ogBiBODgDMAJgCCPLAE9C6RACpEs2gG4WbGmQr9EABn2tgcXmo4xTFxA4A8hsLucBqL_WatWdkQAD1MvAFkcAAsAOi4sMAATOABbPHotAEYLA0CjZX5cgIjomMoYMDxg-gBaItZQrTUkAFJtRAB-cxjMxAAuRBqzHozESKhY-KTU9MQvesQ8ciojAB9V83oAekRsywDuLgBtZZ8AXVNg_dZDk4pz02V9gF8DLhoQLiRD_VeIBEoHESOCwvQEaEwILwAFZUNC9Ex_mBAYhgbhZKYIdhcDC4aRsgi4AAHWAIUz-RCwKBEAYU1hQVDBKB9BaoCBRbhQSgxaxcFI4GJYRKJADCqX5lDwaNBMSIYGQE0QOwxXlRINksvQCqiSu09FVAHJEAAFOAVLkGgzPYgGKBwOAEWBE2nW232ggAIzgwVpRSIwGZiANEHQDK4BptAUQwFQOE-qF9UdY0oAWvaUi6iq9WK68hDEomAjYYKGBgaAG6oLiwCBYAgRopcGDIKKB7JWyMheTBGCUAZHBjPM6d5Td3v9wfDgwerggShRF2d1Pp_tFOkBKDKIkJoMVcqJVCWqO5gLr-lbncGvcwA9HgLZxBTm5gGD80lgAbAOvUTvUJuoPtECONcFjALAUkveQGyTSkLzLShaygMNoKTaUBmlTJOyjRJX3QcoAX7A1ggjINlANJ8k0oZQUi9AgAGUYAALx3aQsICGAGRSOjNxpRgFlYYksAgDjlAGYYABYFhPKMth2AhuDQAYoFnVAszYs9BHAy8ACEUKjTdt3gxDkLY5MQXQ9VTNRXDkXgZFCOI0gDTIiioyomiHQY5iBlYhYONQLieJ3DSBKJISRLEmJJJg6SAlktgFJ3ZSQFU48DDOJhnl0IA

Steps to Reproduce

  1. jump to minimum example
  2. enable selection tool
  3. select some points
  4. zoom with mousewheel or select another selection tool
  5. progressive re-rendering takes place

Current Behavior

After re-render only few points remain selected. From few first frames probably. image

Expected Behavior

All points within brushed zones remain selected.

Environment

- OS:Windows 10,11
- Browser: Chrome, Edge
- Framework:

Any additional comments?

No response

DespotMagic commented 2 months ago

This also happens to me even if I only have 10,000 points. After any re-rendering, only a few of the originally selected ones remain. And re-rendering begins to occur when you zoom in/zoom out or simply even if you click on any icon of the Toolbox panel.

helgasoft commented 2 months ago

official example has large:true and works fine. Any reason why you want to disable optimization with large ?

ilius33 commented 2 months ago

official example has large:true and works fine. Any reason why you want to disable optimization with large ?

Yes. The obvious reason. Brush selection doesn't work with large: true at all. I mean you can paint with brush selection tool. But with no effect. No data in event, no style changes.

helgasoft commented 2 months ago

ok, agree, related to #17079 and #9945 BTW all points seem to be showing (tooltip present), but some are not highlighted.

ilius33 commented 2 months ago

ok, agree, related to #17079 and #9945 BTW all points seem to be showing (tooltip present), but some are not highlighted.

Not highlighted and not present in event. BTW tried scatterGL and it is not supporting selection too. So basically there is no option to brushselect on large amount of data and have any perfomance option enabled.

helgasoft commented 2 months ago
  1. progressive re-rendering takes place

Looks like disabling progressive thru progressiveThreshold fixes the zoom problem - Demo.

So basically there is no option to brushselect on large amount of data and have any perfomance option enabled.

Agree.

DespotMagic commented 2 months ago

Looks like disabling progressive thru progressiveThreshold fixes the zoom problem - Demo.

It is clear that this will solve the issue. Problems initially sounded like problems with progressive rendering. In your example there are 5000 points so it works well. In my application for example we need to display up to 100,000 points (or 150,000 points) and be able to select them and zoom in/zoom out this brush area. Performance for 100 000 points with progressive rendering is satisfactory, but the fact that the selected dots disappear during Zoom - this is a blocker for us.

In my opinion this is a progressive rendering error with brush area. Because if you move the selection area even just a little, all the points are immediately selected correctly. Also if I click on "Keep selections" and select additionally some empty area, it will also correct the currently selected brush area and display all the points correctly.
So these actions trigger some internal events of ECharts that force it to render the selected area correctly. And zoom does not trigger these processes during rendering (progressive rendering).

If we can’t fix it, then at least find what event needs to be dispatched after Zoom In/Out to force ECharts to render correctly all points in the selected area and get the correct list of selected points in "brushSelected" event.

helgasoft commented 2 months ago

...if you move the selection area even just a little, all the points are immediately selected correctly.

@DespotMagic, frankly I cannot reproduce your findings. What would be helpful is to update the Demo (more data, add dataZoom?) and explain the steps on how to reproduce the problem.

DespotMagic commented 2 months ago

@DespotMagic, frankly I cannot reproduce your findings. What would be helpful is to update the Demo (more data, add dataZoom?) and explain the steps on how to reproduce the problem.

@helgasoft thank you for trying to help) This can be easily reproduced using the example from ilius33 https://github.com/apache/echarts/issues/19857#issue-2256195799. We are taking the same steps that ilius33 indicated. And then we just move (drag) the area with the mouse.

Steps:

  1. jump to minimum example
  2. enable selection tool
  3. select some points
  4. zoom or select another selection tool
  5. :exclamation: AR: only few points remain selected (current problem described in this bug)
  6. move (drag) the selected area with the mouse
  7. AR: All points within brushed zones remain selected :ok_hand:.

Example for 100,000 points on video There you can see the problem: how the points are not rendered after Zoom. and how everything rendered corrected (all selected points) if I drag the selection area a little.

helgasoft commented 2 months ago

Thank you for the detailed explanation. Just step 4 might be better defined as "zoom with mouse scroll wheel". Indeed the selection area drag is able to refresh its content successfully. So I think the zoom bug may not be that difficult to fix ...if a brave & knowledgeable volunteer has time to dive in.

helgasoft commented 2 months ago

On reflection and looking from a different perspective - zoom and brush seem to be completely unrelated actions in ECharts. As seen in the example, selected area size does not change on zoom. But it should, if zoom and brush-select were integrated! My guess is that brush-select is pixel(canvas) based, and zoom is based on chart coordinates, so they are incompatible. Brush-select is also an isolated, singular event and its result does not persist in further chart manipulations like pan and zoom.

yougdlek commented 1 month ago

@DespotMagic @helgasoft Hello, Is There any plan or stopgap to address the issue? I also face that issues