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

X-Axis title disappears when editing bar chart #30370

Open
1 of 3 tasks
BGZ-spec opened this issue Sep 24, 2024 · 12 comments · May be fixed by #30821
Open
1 of 3 tasks

X-Axis title disappears when editing bar chart #30370

BGZ-spec opened this issue Sep 24, 2024 · 12 comments · May be fixed by #30821
Labels
change:frontend Requires changing the frontend validation:validated A committer has validated / submitted the issue or it was reported by multiple users viz:charts:bar Related to the Bar chart

Comments

@BGZ-spec
Copy link

BGZ-spec commented Sep 24, 2024

Bug description

Description

When editing a bar chart in Superset, changing the X-axis title causes the title to disappear. Similarly, adjusting the margins leads to unexpected behavior—they either reset or are not applied correctly.

How to reproduce the bug

Open an existing bar chart in Superset or create a new one.
Enter the edit mode for the chart.
Change the X-axis title to a new value.
Observe that the X-axis title disappears from the chart.
Adjust the margin settings.
Notice that the margins do not update as expected or revert to previous settings.

Screenshots/recordings

Screencast.from.2024-09-24.10-57-58.webm

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Firefox

Additional context

No response

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.

This comment was marked as off-topic.

@dosubot dosubot bot added change:frontend Requires changing the frontend viz:charts:bar Related to the Bar chart labels Sep 24, 2024
@BGZ-spec
Copy link
Author

@dosu
I have the original version of the code and haven't changed anything. I downloaded a clean, fresh version of Superset.

controlSetRows: [
        [<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
        ...createAxisTitleControl('x'),
        [<ControlSubSectionHeader>{t('Y Axis')}</ControlSubSectionHeader>],
        ...createAxisTitleControl('y'),
      ],

When I comment out ...createAxisTitleControl('y'), changing the X-axis title works correctly.

This comment was marked as off-topic.

@viktorfilyk4
Copy link

Hi!
I pulled repo today, setup project using docker-compose and I encounter the same issue. I would like to work on this.
As I read comments above it seems like only frontend issue

@rusackas
Copy link
Member

rusackas commented Oct 1, 2024

@viktorfilyk4 that would very much be appreciated. Ping us here if/when you open a PR. Thanks in advance!

@BGZ-spec
Copy link
Author

BGZ-spec commented Oct 2, 2024

Has anyone managed to fix the problem?

@viktorfilyk4
Copy link

@BGZ-spec I am currently working on this. Trying to figure out what's the problem. The same for me, when I comment ...createAxisTitleControl('y') line, it works fine.

Any suggestions?

@viktorfilyk4
Copy link

@dosu
Can you suggest how to fix this problem?

Copy link

dosubot bot commented Oct 3, 2024

To fix the issue with the X-axis title disappearing when both createAxisTitleControl('x') and createAxisTitleControl('y') are used, you need to ensure that the visibility conditions for the axis titles are correctly set based on the chart's orientation.

The visibility condition for the X-axis title is currently set to be visible only when the chart is vertical:

visibility: ({ controls }: ControlPanelsContainerProps) =>
  isXAxis ? isVertical(controls) : isHorizontal(controls),

To ensure the X-axis title is visible when it should be, verify that the orientation control is correctly set to Vertical when you want the X-axis title to appear. If the chart orientation is not set to Vertical, the X-axis title will not be visible.

Similarly, ensure that the Y-axis title visibility condition is set correctly:

visibility: ({ controls }: ControlPanelsContainerProps) =>
  isXAxis ? isHorizontal(controls) : isVertical(controls),

This condition ensures that the Y-axis title is visible when the chart is horizontal. Adjust the chart's orientation settings accordingly to make sure the axis titles appear as expected [1].

To continue talking to Dosu, mention @dosu.

@sfirke sfirke added the validation:validated A committer has validated / submitted the issue or it was reported by multiple users label Oct 16, 2024
@sfirke
Copy link
Member

sfirke commented Oct 16, 2024

I'm experiencing this when creating a bar chart with a categorical x-axis in 4.0.2.

@DamianPendrak DamianPendrak linked a pull request Nov 2, 2024 that will close this issue
9 tasks
@DamianPendrak
Copy link

Hi, I noticed the issue has been unassigned and without updates for a while, I went ahead and created a pull request #30821 to address it. I hope this helps! Let me know if there's anything you'd like me to adjust.
@rusackas @sfirke

@curio77
Copy link

curio77 commented Nov 11, 2024

Happens here too with a fresh setup of v4.0.2. Also, if the (X) axis title does not disappear, the title margin is not respected.

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 validation:validated A committer has validated / submitted the issue or it was reported by multiple users viz:charts:bar Related to the Bar chart
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants