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

feat(charts): add subtitle option and metric customization controls #32975

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

Conversation

LevisNgigi
Copy link
Contributor

@LevisNgigi LevisNgigi commented Apr 2, 2025

feat(charts): add subtitle option and metric customization controls

SUMMARY

This PR adds two key improvements to visualization controls:

  1. Added subtitle functionality to big number charts visualizations.Moved subheader input previously in BigNumber to subtitle under customize tab.

  2. Enhanced the explore view with controls that allow users to:

    • Rename comparison metrics (main, #, and delta values) in both big number with time comparison chart and table chart.
    • Toggle visibility of specific metric icon and columns
    • Persist these customizations when the visualization is saved

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

metric_rename.mp4

TESTING INSTRUCTIONS

  1. Big Number with Trendline:

    • Create a new chart using the "Big Number with Trendline" visualization
    • Verify the subtitle option appears in the customize section.
    • Add text to the subtitle and confirm it displays correctly.
  2. **Big Number **:

    • Create a new chart using the "Big Number" visualization
    • Verify the subtitle option appears in the customize section.
    • Add text to the subtitle and confirm it displays correctly.
  3. Big Number with Time Comparisons (requires CHART_PLUGINS_EXPERIMENTAL flag):

    • Enable the CHART_PLUGINS_EXPERIMENTAL feature flag
    • Create a chart using the "Big Number with Time Comparisons" visualization
    • Verify the subtitle option appears and functions correctly
  4. Metric Customization:

    • Create a chart using "Table" and create a time comparison.
    • In the explore view, locate the new controls for renaming comparison metrics
    • Test renaming the main, #, and delta metrics
    • Test toggling visibility of specific columns
    • Save the chart and verify the customizations persist when reopened

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • [ x] 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

Copy link

korbit-ai bot commented Apr 2, 2025

Based on your review schedule, I'll hold off on reviewing this PR until it's marked as ready for review. If you'd like me to take a look now, comment /korbit-review.

Your admin can change your review schedule in the Korbit Console

@github-actions github-actions bot added api Related to the REST API plugins labels Apr 2, 2025
@github-actions github-actions bot removed the api Related to the REST API label Apr 2, 2025
@LevisNgigi LevisNgigi changed the title feat(charts): add subheader option and metric customization controls feat(charts): add subtitle option and metric customization controls Apr 4, 2025
@LevisNgigi LevisNgigi marked this pull request as ready for review April 7, 2025 12:15
@dosubot dosubot bot added viz:charts:bignumber Related to BigNumber charts viz:charts:table Related to the Table chart labels Apr 7, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Readability Unexplained Magic Number in Styles ▹ view 🧠 Not in standard
Error Handling Unsafe DOM cleanup in renderSubtitle ▹ view ✅ Fix detected
Performance Inconsistent Debounce Delays ▹ view
Files scanned
File Path Reviewed
superset-frontend/src/explore/components/controls/ColumnConfigControl/types.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/types.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/types.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/transformProps.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/sharedControls.ts
superset-frontend/plugins/plugin-chart-table/src/types.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.ts
superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigItem.tsx
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/controlPanel.ts
superset-frontend/src/explore/components/controls/ColumnConfigControl/ColumnConfigControl.tsx
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts
superset-frontend/src/explore/components/controls/ColumnConfigControl/constants.tsx
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.ts
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/PopKPI.tsx
superset-frontend/plugins/plugin-chart-table/src/transformProps.ts
superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • On any given comment that Korbit raises on your pull request, you can have a discussion with Korbit by replying to the comment.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Feedback and Support

Comment on lines +145 to +153
const SubtitleText = styled.div`
${({ theme }) => `
font-family: ${theme.typography.families.sansSerif};
font-weight: ${theme.typography.weights.medium};
text-align: center;
margin-top: -10px;
margin-bottom: ${theme.gridUnit * 4}px;
`}
`;

This comment was marked as resolved.

Copy link
Member

@geido geido left a comment

Choose a reason for hiding this comment

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

Some first-pass comments. This seems great so far!

Copy link
Contributor

github-actions bot commented Apr 8, 2025

@geido Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

github-actions bot commented Apr 8, 2025

@geido Ephemeral environment spinning up at http://34.222.109.82:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

@kgabryje
Copy link
Member

kgabryje commented Apr 9, 2025

@LevisNgigi Thanks for the contribution, it's looking good!
'm not sure about is reverting to the metric name if the label is left empty and display type icon is unchecked.
Also, if we use a saved metric with a label, the metric name displayed in time comparison when display type is unchecked is the metric's name (not "user friendly") instead of the label (see COUNT(*) metric displayed as count).

1 more thing - I think that the metric item is unnecessarily indented in the Customize columns control (see on the recording).

Screen.Recording.2025-04-09.at.13.49.11.mov

@kgabryje
Copy link
Member

kgabryje commented Apr 9, 2025

Oh and 1 more thing, not sure if related to your PR - the changes in Customize columns applied to the columns generated by time comparison (e.g. # count__1 month ago) have no effect on the table

@LevisNgigi
Copy link
Contributor Author

@LevisNgigi Thanks for the contribution, it's looking good! 'm not sure about is reverting to the metric name if the label is left empty and display type icon is unchecked. Also, if we use a saved metric with a label, the metric name displayed in time comparison when display type is unchecked is the metric's name (not "user friendly") instead of the label (see COUNT(*) metric displayed as count).

1 more thing - I think that the metric item is unnecessarily indented in the Customize columns control (see on the recording).

Screen.Recording.2025-04-09.at.13.49.11.mov

@kgabryje About the not user friendly being displayed, I fixed that in my last commit such that if label is left empty(unchecked) and no custom column name,column name remains empty(as suggested in design) instead of displaying metric name.

Copy link
Contributor

github-actions bot commented Apr 9, 2025

@geido Processing your ephemeral environment request here. Action: up. More information on how to use or configure ephemeral environments

Copy link
Contributor

github-actions bot commented Apr 9, 2025

@geido Ephemeral environment spinning up at http://18.246.212.242:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.

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.

4 participants