You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "PolinaFam (via GitHub)" <gi...@apache.org> on 2025/11/05 13:03:31 UTC
[PR] feat(chart): add axes settings for trendline [superset]
PolinaFam opened a new pull request, #36002:
URL: https://github.com/apache/superset/pull/36002
### SUMMARY
This PR implements the feature requested in Issue #35891. It adds axis configuration options to the trendline in the Big Number chart, addressing the current lack of context around the data's timeframe and value range.
New Configuration Options
- Show X Axis / Show Y Axis: Toggles to control the visibility of each axis.
- Show Min/Max Axis Labels: Toggles to control the visibility of labels for the minimum and maximum values on both the X and Y axes.
Technical Details
- The implementation extends the existing BigNumberWithTrendline chart by adding new properties to its control configuration and props interface.
- The chart's transformProps function was modified to pass the new settings to the underlying trendline visualization component.
- The existing number and date formatting utilities are used for the axis labels. The Y-axis labels inherit the main metric's number format, and the X-axis labels use the existing date format settings applied to the time column.
Testing
- Manually tested all new configuration options in various combinations to ensure they work correctly and do not conflict with existing settings.
- Verified that the chart behaves correctly when axes are hidden.
- Confirmed that the min/max labels accurately reflect the dataset.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
<img width="1611" height="778" alt="image" src="https://github.com/user-attachments/assets/8acc3d8d-10ac-4d0e-8273-735d71beb9d5" />
AFTER
<img width="1614" height="788" alt="image" src="https://github.com/user-attachments/assets/b9f91548-8469-45ac-ba13-d8f41059a724" />
### TESTING INSTRUCTIONS
1. Create or edit a "Big Number with Trendline" chart.
2. In the "Customize" tab, scroll to find the new Axis sections.
3. Test Axis Visibility:
- Enable "Show X Axis" and "Show Y Axis". The chart should now display both axes.
- Toggle the settings off and on to ensure the axes correctly appear and disappear.
4. Test Min/Max Labels:
- Enable the "Show Min/Max Axis Labels" option.
- Verify that the Y-axis shows labels for the smallest and largest values.
- Verify that the X-axis shows labels for the start and end of the period.
5. Test Formatting Consistency:
- Change the number format for the main metric (e.g., to a currency). The Y-axis min/max labels should reflect this new format.
- Change the date format for the time column. The X-axis min/max labels should update to the new date format.
### ADDITIONAL INFORMATION
- [x] Has associated issue: #35891
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3554199128
πͺ [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/19512594650) for [9a30dda](https://github.com/apache/superset/commit/9a30dda)
β’ **Environment:** http://35.90.52.200:8080 (admin/admin)
β’ **Lifetime:** 48h auto-cleanup
β’ **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #36002:
URL: https://github.com/apache/superset/pull/36002#discussion_r2494402483
##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx:
##########
@@ -145,6 +146,64 @@ const config: ControlPanelConfig = {
[subtitleFontSize],
[showMetricNameControl],
[metricNameFontSizeWithVisibility],
+ [<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
+ [
+ {
+ name: 'show_x_axis',
+ config: {
+ type: 'CheckboxControl',
+ label: t('Show X-axis'),
+ renderTrigger: true,
+ default: false,
+ description: t('Whether to display the X Axis'),
+ },
+ },
+ ],
+ [
+ {
+ name: 'show_x_axis_min_max_labels',
+ config: {
+ type: 'CheckboxControl',
+ label: t('Show min/max axis labels'),
+ renderTrigger: true,
+ default: false,
+ description: t(
+ 'When enabled, the axis will display labels for the minimum and maximum values of your data',
+ ),
+ visibility: ({ controls }: ControlPanelsContainerProps) =>
+ Boolean(controls?.show_x_axis?.value),
+ },
+ },
+ ],
+ [<ControlSubSectionHeader>{t('Y Axis')}</ControlSubSectionHeader>],
+ [
+ {
+ name: 'show_y_axis',
+ config: {
+ type: 'CheckboxControl',
+ label: t('Show Y-axis'),
+ renderTrigger: true,
+ default: false,
+ description: t('Whether to display the Y Axis'),
+ },
+ },
+ ],
+ [
+ {
+ name: 'show_y_axis_min_max_labels',
+ config: {
+ type: 'CheckboxControl',
+ label: t('Show min/max axis labels'),
+ renderTrigger: true,
+ default: false,
+ description: t(
+ 'When enabled, the axis will display labels for the minimum and maximum values of your data',
+ ),
+ visibility: ({ controls }: ControlPanelsContainerProps) =>
+ Boolean(controls?.show_y_axis?.value),
Review Comment:
### Unsafe property access in visibility function <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The visibility function for show_y_axis_min_max_labels control may fail if controls.show_y_axis is undefined or null, potentially causing a runtime error when accessing the value property.
###### Why this matters
This could cause the control panel to crash or behave unexpectedly when the show_y_axis control hasn't been initialized yet or is in an undefined state.
###### Suggested change β *Feature Preview*
Add additional safety checks to handle undefined controls:
```typescript
visibility: ({ controls }: ControlPanelsContainerProps) =>
Boolean(controls?.show_y_axis?.value)
```
Or more defensively:
```typescript
visibility: ({ controls }: ControlPanelsContainerProps) =>
controls?.show_y_axis?.value === true
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1ba93128-a040-4825-afa4-18861e357acc/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1ba93128-a040-4825-afa4-18861e357acc?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1ba93128-a040-4825-afa4-18861e357acc?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1ba93128-a040-4825-afa4-18861e357acc?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/1ba93128-a040-4825-afa4-18861e357acc)
</details>
<sub>
π¬ Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:54005ded-1596-43a0-809a-59fd3f074491 -->
[](54005ded-1596-43a0-809a-59fd3f074491)
##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/controlPanel.tsx:
##########
@@ -145,6 +146,64 @@ const config: ControlPanelConfig = {
[subtitleFontSize],
[showMetricNameControl],
[metricNameFontSizeWithVisibility],
+ [<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
+ [
+ {
+ name: 'show_x_axis',
+ config: {
+ type: 'CheckboxControl',
+ label: t('Show X-axis'),
+ renderTrigger: true,
+ default: false,
+ description: t('Whether to display the X Axis'),
+ },
+ },
+ ],
+ [
+ {
+ name: 'show_x_axis_min_max_labels',
+ config: {
+ type: 'CheckboxControl',
+ label: t('Show min/max axis labels'),
+ renderTrigger: true,
+ default: false,
+ description: t(
+ 'When enabled, the axis will display labels for the minimum and maximum values of your data',
+ ),
+ visibility: ({ controls }: ControlPanelsContainerProps) =>
+ Boolean(controls?.show_x_axis?.value),
Review Comment:
### Unsafe property access in visibility function <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The visibility function for show_x_axis_min_max_labels control may fail if controls.show_x_axis is undefined or null, potentially causing a runtime error when accessing the value property.
###### Why this matters
This could cause the control panel to crash or behave unexpectedly when the show_x_axis control hasn't been initialized yet or is in an undefined state.
###### Suggested change β *Feature Preview*
Add additional safety checks to handle undefined controls:
```typescript
visibility: ({ controls }: ControlPanelsContainerProps) =>
Boolean(controls?.show_x_axis?.value)
```
Or more defensively:
```typescript
visibility: ({ controls }: ControlPanelsContainerProps) =>
controls?.show_x_axis?.value === true
```
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc3477a6-abe9-4086-b62e-9958752a73ed/upvote) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc3477a6-abe9-4086-b62e-9958752a73ed?what_not_true=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc3477a6-abe9-4086-b62e-9958752a73ed?what_out_of_scope=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc3477a6-abe9-4086-b62e-9958752a73ed?what_not_in_standard=true) [](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/fc3477a6-abe9-4086-b62e-9958752a73ed)
</details>
<sub>
π¬ Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:f6f38c02-f203-4a4c-b01c-e4d5ec52d6fb -->
[](f6f38c02-f203-4a4c-b01c-e4d5ec52d6fb)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3554147744
πͺ [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/19512594650) for [9a30dda](https://github.com/apache/superset/commit/9a30dda)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3583567331
πͺ [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/19720446132) for [5cb8df7](https://github.com/apache/superset/commit/5cb8df7)
β’ **Environment:** http://34.220.158.173:8080 (admin/admin)
β’ **Lifetime:** 48h auto-cleanup
β’ **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3491096807
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3491135221
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/36002?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 48.47%. Comparing base ([`04231c8`](https://app.codecov.io/gh/apache/superset/commit/04231c86dbe0ebafd87acd712b8a85b1ff5e8d1c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9a30dda`](https://app.codecov.io/gh/apache/superset/commit/9a30ddab1de6f42c612d46d12632929af74b8090?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #36002 +/- ##
===========================================
+ Coverage 0 48.47% +48.47%
===========================================
Files 0 622 +622
Lines 0 45712 +45712
Branches 0 4972 +4972
===========================================
+ Hits 0 22157 +22157
- Misses 0 22929 +22929
- Partials 0 626 +626
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/36002/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/36002/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `44.21% <ΓΈ> (?)` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/36002/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `47.75% <ΓΈ> (?)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/36002/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `48.46% <ΓΈ> (?)` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/36002/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ΓΈ> (?)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/36002?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3544410394
Looks like this needs a rebase due to some newly merged translation updates if you don't mind.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "PolinaFam (via GitHub)" <gi...@apache.org>.
PolinaFam commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3570425252
@rusackas
> Looks like this needs a rebase due to some newly merged translation updates if you don't mind.
Merged last changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36002:
URL: https://github.com/apache/superset/pull/36002#issuecomment-3583549871
πͺ [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/19720446132) for [5cb8df7](https://github.com/apache/superset/commit/5cb8df7)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(chart): add axes settings for trendline [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #36002:
URL: https://github.com/apache/superset/pull/36002
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org