Skip to content

fix(client): fixed barchart xaxis and yaxis bug#1121

Merged
johbaxter merged 1 commit intodevfrom
815-bar-chart-axis-bug
May 14, 2025
Merged

fix(client): fixed barchart xaxis and yaxis bug#1121
johbaxter merged 1 commit intodevfrom
815-bar-chart-axis-bug

Conversation

@Shubham009-prog
Copy link
Copy Markdown
Contributor

Description

Fixed Barchart x-Axis and y-Axis label show and hide bug

@Shubham009-prog Shubham009-prog requested a review from johbaxter May 13, 2025 14:10
@Shubham009-prog Shubham009-prog self-assigned this May 13, 2025
@Shubham009-prog Shubham009-prog requested a review from a team as a code owner May 13, 2025 14:10
@Shubham009-prog Shubham009-prog linked an issue May 13, 2025 that may be closed by this pull request
2 tasks
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /describe

@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /review

@QodoAI-Agent
Copy link
Copy Markdown

Title

fix(client): fixed barchart xaxis and yaxis bug


User description

Description

Fixed Barchart x-Axis and y-Axis label show and hide bug


PR Type

Enhancement, Other


Description

  • Added toggle for axis title visibility

  • Conditional axis title update in chart options

  • Initialized showAxisTitle in axis state

  • Reformatted client tables and popovers


Changes walkthrough 📝

Relevant files
Enhancement
Edit-X-Axis.tsx
Add axis title toggle to X-axis editor                                     

libs/renderer/src/components/block-defaults/echart-visualization-block/variant/bar-chart/Edit-X-Axis.tsx

  • Introduce showAxisTitle initial and state
  • Add Switch to toggle axis title visibility
  • Conditionally update xAxis.name and nameTextStyle
  • Remove redundant showAxis handling logic
  • +31/-24 
    Edit-Y-Axis.tsx
    Add axis title toggle to Y-axis editor                                     

    libs/renderer/src/components/block-defaults/echart-visualization-block/variant/bar-chart/Edit-Y-Axis.tsx

  • Add showAxisTitle initial and state
  • Enable Switch to show/hide axis title
  • Update yAxis.name and nameTextStyle conditionally
  • Remove obsolete always-render title logic
  • +34/-25 
    Formatting
    MembersTable.tsx
    Refactor MembersTable logic and formatting                             

    packages/client/src/components/settings/MembersTable.tsx

  • Remove DATABASE type check in getMembersApi
  • Fix all-members checkbox length condition
  • Normalize quotes from single to double
  • Minor JSX formatting adjustments
  • +31/-21 
    UserPopover.tsx
    Format UserPopover JSX structure                                                 

    packages/client/src/components/settings/UserPopover.tsx

  • Reformat grid container JSX attributes
  • Normalize quotes in component props
  • Adjust Avatar markup whitespace
  • Consistent inner grid container formatting
  • +16/-4   
    UserTable.tsx
    Clean up UserTable logic and formatting                                   

    packages/client/src/components/settings/UserTable.tsx

  • Align comment indentation
  • Correct all-members checkbox evaluation
  • Normalize JSX quotes consistency
  • Adjust prop formatting and spacing
  • +24/-18 

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @github-actions
    Copy link
    Copy Markdown

    @CodiumAI-Agent /improve

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Missing Axis Show

    The updateChartData function no longer updates the show property on the xAxis option, so toggling the axis visibility has no effect.

    if (axisData.showAxisTitle) {
        if (axisData.hasOwnProperty("xaxistitle")) {
            option["xAxis"] = {
                ...option["xAxis"],
                ["name"]: axisData.xaxistitle,
            };
        }
        if (axisData.hasOwnProperty("xaxisTitleFontSize")) {
            option["xAxis"] = {
                ...option["xAxis"],
                ["nameTextStyle"]: {
                    ...option["xAxis"]["nameTextStyle"],
                    ["fontSize"]:
                        Number(axisData.xaxisTitleFontSize) ||
                        undefined,
                },
            };
        }
    } else {
    Uncontrolled Switch

    The Switch component uses defaultChecked instead of the controlled checked prop, which can lead to out-of-sync UI state.

    defaultChecked={xaxisState.showAxisTitle ?? undefined}
    onChange={(e: ChangeEvent<HTMLInputElement>) =>
        handleInputChange(
            e,
            "showAxisTitle",
            e.target.checked,
        )
    Popover Not Closing

    The onMouseLeave handler returns the handlePopoverClose function instead of calling it, so the popover never actually closes.

    onMouseEnter={(
        event,
    ) => {
        setAnchorEl(
            event.currentTarget,
        );
        setHoveredUser(

    @QodoAI-Agent
    Copy link
    Copy Markdown

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Restore axis show property

    The "show" property on xAxis is no longer being updated, so toggling axis visibility
    has no effect. You should always spread show: axisData.showAxis into the option
    regardless of title visibility. This will restore the original axis-show toggle
    behavior.

    libs/renderer/src/components/block-defaults/echart-visualization-block/variant/bar-chart/Edit-X-Axis.tsx [206-214]

     if (option.hasOwnProperty("xAxis") && option["xAxis"]) {
    +    option["xAxis"] = {
    +        ...option["xAxis"],
    +        show: axisData.showAxis,
    +    };
         if (axisData.showAxisTitle) {
             // name and nameTextStyle updates...
         } else {
             option["xAxis"] = {
                 ...option["xAxis"],
    -            ["name"]: "",
    +            name: "",
             };
         }
     }
    Suggestion importance[1-10]: 9

    __

    Why: The PR removed updating the show flag on the X axis in updateChartData, breaking axis toggling; restoring it fixes a critical functionality bug.

    High
    Add yAxis show property

    Similar to the X axis, the "show" flag on yAxis is never set, so hiding/showing the
    Y axis does nothing. Always include show: axisData.showAxis when updating
    option.yAxis.

    libs/renderer/src/components/block-defaults/echart-visualization-block/variant/bar-chart/Edit-Y-Axis.tsx [214-237]

     if (option.hasOwnProperty(axis) && option[axis]) {
    +    option["yAxis"] = {
    +        ...option["yAxis"],
    +        show: axisData.showAxis,
    +    };
         if (axisData.showAxisTitle) {
             // name and nameTextStyle updates...
         } else {
             option["yAxis"] = {
                 ...option["yAxis"],
    -            ["name"]: "",
    +            name: "",
             };
         }
     }
    Suggestion importance[1-10]: 9

    __

    Why: Similar to the X axis, the Y axis show flag was omitted in updateChartData, preventing axis visibility toggling and requiring restoration.

    High
    Fix popover close handler

    The onMouseLeave handler currently returns the function instead of calling it, so
    the popover never closes. Change it to directly reference or invoke
    handlePopoverClose.

    packages/client/src/components/settings/MembersTable.tsx [843-861]

     <StyledNameStack
         direction="row"
         onMouseEnter={(event) => {
             setAnchorEl(event.currentTarget);
             setHoveredUser(user);
         }}
    -    onMouseLeave={() =>
    -        handlePopoverClose
    -    }
    +    onMouseLeave={handlePopoverClose}
         aria-owns="mouse-over-popover"
         aria-haspopup="true"
     >
    Suggestion importance[1-10]: 6

    __

    Why: The onMouseLeave callback returns the function instead of invoking or referencing it, so the popover never closes; correcting it improves UI behavior.

    Low

    @Shubham009-prog Shubham009-prog mentioned this pull request May 14, 2025
    2 tasks
    @johbaxter johbaxter merged commit fa1ec8a into dev May 14, 2025
    4 checks passed
    @johbaxter johbaxter deleted the 815-bar-chart-axis-bug branch May 14, 2025 19:20
    @github-actions
    Copy link
    Copy Markdown

    @CodiumAI-Agent /update_changelog

    @QodoAI-Agent
    Copy link
    Copy Markdown

    Changelog updates: 🔄

    2025-05-14 *

    Fixed

    • Bar chart x-axis and y-axis title show/hide toggle bug
    • Corrected axis title font size handling when hidden or shown

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    Bar Chart Axis Bug

    3 participants