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

fix: x axis title disappears when editing bar chart #30821

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DamianPendrak
Copy link

Fixes #30370

SUMMARY

The createAxisTitleControl and createAxisControl functions use the visibility prop to hide controls. This caused an issue where controls with duplicate names were stashed from the form data if one of them had visibility set to false and was rendered later than the visible one.

Solution

To resolve this, I introduced a new prop disableStash, to the Control component, which prevents stashing for the control where it is applied.
Additionally, I set the resetOnHide prop to false to prevent the axis titles from disappearing on the chart when changing the orientation.

Hidden prop bug

Initially, I considered replacing visibility with a hidden prop in the Bar chart controls. However, this approach led to issues with refreshing hidden control values and I decided to keep the visibility prop for a less invasive change.
While working with the hidden prop, I discovered a bug where {...restProps} overwrote the hidden prop's intended value, so () => false value was hiding the control. I plan to address this in a separate issue. The first commit reflects this initial approach, but I reverted it in the following commit to keep this PR focused on the visibility prop and disableStash solution.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

Kapture.2024-11-02.at.11.31.45.mp4

After

Kapture.2024-11-02.at.10.48.54-2.mp4

TESTING INSTRUCTIONS

  1. Open an existing bar chart in Superset or create a new one.
  2. Enter the edit mode for the chart.
  3. Change the X-axis title and/or margin to a new value.
  4. Switch between horizontal and vertical orientation and edit values again

ADDITIONAL INFORMATION

  • Has associated issue: #30370
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added the viz:charts:bar Related to the Bar chart label Nov 2, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@eschutho
Copy link
Member

Thanks @DamianPendrak I'll set up a testing environment for us to take a look

@eschutho
Copy link
Member

/testenv up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

X-Axis title disappears when editing bar chart
2 participants