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: Add show axis to timeseries #26409

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

Conversation

kainchow
Copy link
Contributor

@kainchow kainchow commented Jan 4, 2024

SUMMARY

Adding Show/Hide Axis Controls to Bar charts.
For Bar charts or Line charts, if I add values to the bar or to the line, then I may not need to show the axis because it would interfere with the look and feel and would not be aesthetically pleasing, such as the following:
image

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

20240104-183647.mp4

TESTING INSTRUCTIONS

Create a Bar chart and click on the Y Axis in CUSTOMIZE and unfilter "SHOW AXIS" to hide the Y Axis (HORIZONTAL is the X Axis).

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

@john-bodley
Copy link
Member

john-bodley commented Jan 4, 2024

Thanks @kainchow for the PR. Would you mind providing more context in your PR description as to why this could be valuable and/or necessary?

Also it seems like you included changes from #26407 here. Would you mind resolving this issue?

@john-bodley
Copy link
Member

/testenv up

Copy link
Contributor

github-actions bot commented Jan 4, 2024

@john-bodley Ephemeral environment creation is currently limited to committers.

@kainchow
Copy link
Contributor Author

kainchow commented Jan 5, 2024

@john-bodley Sure, I just added some background information. But I don't know why the check is giving me an error, can you help me out?

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

First pass comments

minorSplitLine,
truncateYAxis,
yAxisBounds,
zoomable,
orientation,
showAxis,
Copy link
Member

Choose a reason for hiding this comment

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

This appears to be here twice

Comment on lines +563 to +580
const yAxisLeftOffset = showAxis
? 0
: TIMESERIES_CONSTANTS.yAxisLabelLeftOffset;
let leftOffset: number;
if (yAxisTitlePosition === 'Left' && showAxis) {
leftOffset =
TIMESERIES_CONSTANTS.gridOffsetLeft + (Number(yAxisTitleMargin) || 0);
} else if (yAxisTitlePosition === 'Left' && !showAxis) {
leftOffset =
TIMESERIES_CONSTANTS.gridOffsetLeft +
(Number(yAxisTitleMargin) || 0) -
(Number(yAxisLeftOffset) || 0);
} else if (yAxisTitlePosition !== 'Left' && !showAxis) {
leftOffset =
TIMESERIES_CONSTANTS.gridOffsetLeft - (Number(yAxisLeftOffset) || 0);
} else {
leftOffset = TIMESERIES_CONSTANTS.gridOffsetLeft;
}
Copy link
Member

Choose a reason for hiding this comment

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

This is maybe slightly heavy on the eyes. Would it be possible to add a few comments here explaining what's going on? Or better yet, maybe add a few self explanatory tests?

Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (d34874c) 69.48% compared to head (2b63425) 69.51%.

Files Patch % Lines
...lugin-chart-echarts/src/Timeseries/transformers.ts 25.00% 5 Missing and 4 partials ⚠️
...charts/src/Timeseries/Regular/Bar/controlPanel.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #26409      +/-   ##
==========================================
+ Coverage   69.48%   69.51%   +0.02%     
==========================================
  Files        1894     1905      +11     
  Lines       74138    74727     +589     
  Branches     8243     8250       +7     
==========================================
+ Hits        51514    51945     +431     
- Misses      20555    20710     +155     
- Partials     2069     2072       +3     
Flag Coverage Δ
javascript 56.85% <23.07%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justin-tomlinson
Copy link

Legend!

I was just mentioning this exact enhancement in slack a month or so ago. https://apache-superset.slack.com/archives/CCKHMGRRB/p1706055529343849.

Useful feature for just making nicer looking dashboard.

@rusackas
Copy link
Member

Looks like this needs a rebase. And @john-bodley can hopefully spin up a test this time when CI passes ;)

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.

None yet

5 participants