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: duplicate truncateXAxis option in BarChart #29916

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

dmitriyVasilievich1986
Copy link
Contributor

SUMMARY

In control panel for echart/BarChart there is a factory-function that supposed to build panels for x/y axises. Unfortunately truncateXAxis and xAxisBounds do not affected by axis name, therefore those options appears in both panels('X Axis', 'Y Axis'). They are complete duplicate and share the same state. Solution is to move those options from factory-function directly to controlSetRows.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screenshot 2024-08-12 at 11 35 38 Screenshot 2024-08-12 at 11 57 19

TESTING INSTRUCTIONS

The problem is available in the chart editor in the customization panel. Since both options have a same state, the value changes in both.

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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 change:frontend Requires changing the frontend viz:charts:bar Related to the Bar chart labels Aug 12, 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.

@kgabryje
Copy link
Member

@dmitriyVasilievich1986 Thanks for the fix! I wonder if we should tie truncateXAxis position to the bars' orientation. In the default "vertical" mode, truncate x axis truncates the horizontal axis (X) as expected. But if you change the orientation to horizontal, then truncate x axis actually truncates the vertical Y axis.
So maybe we should override truncateXAxis control's visibility and label (X if vertical, Y if horizontal) based on the orientation. WDYT?

@dmitriyVasilievich1986
Copy link
Contributor Author

Good day. I looked at what could be done to solve this problem. Unfortunately I think that in order to use generic truncateXAxis and xAxisBounds panels you will have to make too many changes. The easiest option is to delete those generic ones and instead make a copy of the abstract ones for the y-axis. Replacing the name and visibility conditions.
I tested this option and switching the chart orientation worked without problems. I can make a commit with this option. Or am I missing something else?

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

Got it, thanks for the context @dmitriyVasilievich1986. LGTM

@kgabryje kgabryje merged commit e886cc4 into apache:master Aug 28, 2024
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:frontend Requires changing the frontend plugins size/XS viz:charts:bar Related to the Bar chart
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants