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

Line chart legend resets it's state whenever you scroll down the page #31741

Open
3 tasks done
Vicinius opened this issue Jan 7, 2025 · 4 comments
Open
3 tasks done
Labels
viz:charts:line Related to the Line chart

Comments

@Vicinius
Copy link

Vicinius commented Jan 7, 2025

Bug description

  1. Create a dashboard long enough that you have to scroll down
  2. Create a line chart with legends on
  3. Select any category, using inv or all or only one
  4. Scroll down until you can't see the chart anymore
  5. Go back to it, the state of the legend will be reset

Screenshots/recordings

chart_error_1

Superset version

4.0.2

Python version

I don't know

Node version

I don't know

Browser

Chrome

Additional context

We are using Apache Druid

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added the viz:charts:line Related to the Line chart label Jan 7, 2025
Copy link

dosubot bot commented Jan 7, 2025

The issue you're experiencing with the line chart legend resetting its state when scrolling might be related to how Superset manages the visibility of chart components. Superset uses the IntersectionObserver API to determine if a component is in view, which could potentially affect the state of interactive elements like legends when they are scrolled out of view and then back into view [1].

Additionally, the event listeners attached to the line chart component, such as legendselectchanged, legendselectall, and legendinverseselect, are responsible for updating the legend state when interactions occur. However, these handlers might not be preserving the state when the chart is scrolled out of view [2].

To address this issue, you might need to look into how the state of the legend is being managed and consider implementing a mechanism to persist the state across scroll events. This could involve storing the state in a more persistent way, such as in a global state or using local storage, to ensure it is retained when the chart is scrolled back into view.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@rusackas
Copy link
Member

rusackas commented Jan 8, 2025

Hmmm... I'm thus far unable to reproduce this. Maybe @sadpandajoe is able to somewhere?

@sadircardoso
Copy link

I have the same problem here, when the dashboard is very long and is embedded in a system, this problem occurs.

@cguinard-fbx
Copy link

Hello, same here, any idea how to fix this? Is it already tracked in an other issue maybe? we run superset 4.1.1 and embed charts in a react app with iframe, using chrome latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
viz:charts:line Related to the Line chart
Projects
None yet
Development

No branches or pull requests

4 participants