-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
fix(chart): Time Series set showMaxLabel as null for time xAxis #20627
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20627 +/- ##
==========================================
- Coverage 66.85% 66.85% -0.01%
==========================================
Files 1753 1753
Lines 65825 65827 +2
Branches 7006 7007 +1
==========================================
Hits 44010 44010
- Misses 20030 20031 +1
- Partials 1785 1786 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
49829e3
to
f45157e
Compare
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
Outdated
Show resolved
Hide resolved
4d489ea
to
9fe79a1
Compare
/testenv up |
@rusackas Container image not yet published for this PR. Please try again when build is complete. |
@rusackas Ephemeral environment creation failed. Please check the Actions logs for details. |
/testenv up |
@rusackas Container image not yet published for this PR. Please try again when build is complete. |
@rusackas Ephemeral environment creation failed. Please check the Actions logs for details. |
9fe79a1
to
3bd419f
Compare
🏷️ preset-patch |
@@ -326,13 +327,23 @@ export default function transformProps( | |||
rotate: xAxisLabelRotation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rotate: xAxisLabelRotation, | |
rotate: xAxisLabelRotation, |
rotate: xAxisLabelRotation, | |
rotate: xAxisLabelRotation, | |
showLabel: xAxisType === AxisType.time ? null : false, |
looks like we can use one line to meet the requirement 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do that you will be overriding default values for other axis types to false
. Which might not be the desire output and might impact how other axis behave?. I would rather let the defaults for other types be set in Echarts
and respect their criteria and being explicit to overriding only when/where we need to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. This point makes sense. Another I'm curious why not set showMaxLabel
option here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How so? I mean, setting showMaxLabel
here (in this initial declaration) is precisely what I avoid doing so we don't override the defaults for other types (this initial value gets used for all xAxis types). 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you made me realize I call it showLabel
and not showMaxLabel
with my second commit. Let me fix that ASAP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another suggestion is we can try to set FEATURE_GENERIC_CHART_AXES=true
to see if it also works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be mistaken, however, based on this from the README:
A new feature flag GENERIC_CHART_AXES has been added that makes it possible to
use a non-temporal x-axis on the ECharts Timeseries chart
([#17917](https://github.com/apache/superset/pull/17917)). When enabled, a new
control "X Axis" is added to the control panel of ECharts line, area, bar, step and
scatter charts, which makes it possible to use categorical or numerical x-axes on
those charts.
If that's true those are exactly the axis types we don't want to include with these changes. Nonetheless, let me try setting it as true and see if it actually fix the issue by itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephenLYZ enabling that flag we get the last month to show but the chart looks off to me and the format is not correct:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That second one does look odd... is there a way to solve for that? If there's no 0
month, it seems like that shouldn't be on the X axis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the misunderstanding. I was showing the result for the approach mentioned above about enabling the flag (with no code changes).
So the first image shows the chart with the code changes in this PR
/testenv up FEATURE_GENERIC_CHART_AXES=true |
@stephenLYZ Container image not yet published for this PR. Please try again when build is complete. |
@stephenLYZ Ephemeral environment creation failed. Please check the Actions logs for details. |
-Apache echarts has this option as false by default for time axis, so we need to override it for our charts so it's uto determined and not fixed to hidden. - Add AxisType enum so we stop comparing agains raw strings when checking xAxis type
- set the showMaxLabel option directly without using merge
- Rename the property to showMaxLabel as it was originally
3bd419f
to
3169da9
Compare
/testenv up FEATURE_GENERIC_CHART_AXES=true |
@rusackas Container image not yet published for this PR. Please try again when build is complete. |
@rusackas Ephemeral environment creation failed. Please check the Actions logs for details. |
@rusackas Container image not yet published for this PR. Please try again when build is complete. |
@rusackas Ephemeral environment creation failed. Please check the Actions logs for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ephemeral environments are obviously flaky here, but based on the code/screenshots/discussion, I think we're OK here.
@Antonio-RiveroMartnez I've noticed that this PR has caused time series charts to show weird max labels when the chart is wide enough: Removing IIRC, setting Ping also reviewers @rusackas and @diegomedina248 |
Hey @villebro , thanks for the catch 🙌 , I'm more than happy reverting the changes if they are causing issues.
Now, I might be wrong, but finding a new approach might get us to address the issue directly on ECharts, since it is the one in charge for how to render such labels. |
I just happened to stumble upon this thread. It doesn't look like this was reverted, in case this is causing any further issues/complaints (cc @yousoph for good measure) |
Oh! Thanks, yeah I don't think we reverted it or fixed the extra timestamp label. We'll take a look |
if possible, please revert this in 2.1.1 because of the extra timestamp label displayed at the end |
The issue is labelled for 2.1 already, but I'll CC @Antonio-RiveroMartnez and @eschutho for good measure. I'm not sure if it's easier at this point to revert or to fix forward, so I'll leave the choice to them. |
…is (apache#20627)" This reverts commit 9362e27.
…e xAxis (apache#20627) (apache#24995) (cherry picked from commit 2b63577)
…e xAxis (apache#20627) (apache#24995) (cherry picked from commit 2b63577)
SUMMARY
showMaxLabel
option set tofalse
by default for time axis (https://github.com/apache/echarts/blob/master/src/coord/axisDefault.ts#L178), so we need to override it for our time series charts in order to not be fixed with hidden and instead let the library determine whether to show the label of the max tickBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE:
AFTER:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION