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

Add option for BigNumber to not start y-axis at 0 #5552

Merged
merged 2 commits into from
Aug 6, 2018

Conversation

kristw
Copy link
Contributor

@kristw kristw commented Aug 3, 2018

With the recent change to BigNumber, the BigNumber with trend line will start y-axis at 0 by default. However, this behavior may be not desirable in some situation, so this PR add an option to overwrite that and start y-axis at min value instead.

image

image

@graceguo-supercat @williaster

@codecov-io
Copy link

codecov-io commented Aug 3, 2018

Codecov Report

Merging #5552 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5552      +/-   ##
==========================================
- Coverage   63.36%   63.36%   -0.01%     
==========================================
  Files         351      351              
  Lines       22258    22259       +1     
  Branches     2470     2470              
==========================================
  Hits        14104    14104              
- Misses       8139     8140       +1     
  Partials       15       15
Impacted Files Coverage Δ
superset/assets/src/explore/visTypes.jsx 57.14% <ø> (ø) ⬆️
superset/assets/src/explore/controls.jsx 46.96% <ø> (ø) ⬆️
superset/assets/src/visualizations/BigNumber.jsx 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7f9dab...0ec8664. Read the comment docs.

Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

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

Thanks for adding this. My only question is about the language as I think we may have a similar feature elsewhere and thus it would be great if this was consisent.

@williaster
Copy link
Contributor

I believe we have a y-min/max setting for the nvd3 line chart, but I think a boolean is better here.

In person we discussed actually preferring the option "start y-axis at 0" (rather than the negated version it is now), the issue is that we want the default to be true in that case, and since slices don't have this parameter yet it would default to falsy.

In thinking about this more though, we could use the preferred "start y-axis at 0," and then check if the value === false. that way, although current slices would have an undefined, it would result in a 0 y-axis as we want because === false is false. thoughts?

@mistercrunch
Copy link
Member

mistercrunch commented Aug 3, 2018

@williaster controls have a default attribute that should get populated properly for all charts saved pre-existing the control. This should work well for either true/false and both in the context of the dashboard and the explore view.

But yes, the default should be to not be 0-bound since this is the previous behavior and much like a sparkline: we want to highlight how that big number is trending.

@kristw
Copy link
Contributor Author

kristw commented Aug 3, 2018

@mistercrunch I tried setting the default to true and explore the existing chart. However, the checkbox remains unchecked by default. The value received is false. Doing some investigation on that.

@mistercrunch
Copy link
Member

@kristw make sure to follow go vanilla from following a plain link from a chart that was save before the control existed. If you had loaded the chart prior to changing/setting the default, the value may have gotten materialized in the URL, and then stays when refreshing the page.

@kristw
Copy link
Contributor Author

kristw commented Aug 3, 2018

I clicked on "Explore chart" from a dashboard

image

@mistercrunch
Copy link
Member

@kristw from my understanding, this function https://github.com/apache/incubator-superset/blob/master/superset/assets/src/explore/store.js#L102 should be applying defaults to values that are missing. You may have to debug why that's not the case.

@@ -1479,6 +1479,14 @@ export const controls = {
description: t('Whether to display the trend line'),
},

do_not_start_y_axis_at_zero: {
type: 'CheckboxControl',
label: t('Do not start y-axis at 0'),
Copy link
Member

@hughhhh hughhhh Aug 5, 2018

Choose a reason for hiding this comment

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

Can we use positive logic here. Instead of do_not_start_y_axis_at_zero can we make it start_y_axis_at_zero. Changing the name you can pull off the ! here

I feel like most users actually prefer the Y axis to be set to the min value so we can leave default as false.

@kristw
Copy link
Contributor Author

kristw commented Aug 6, 2018

Somehow after restarting machine the default value works. Must be glitch on my machine. Thanks @mistercrunch

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

LGTM

@williaster williaster merged commit aa14bac into apache:master Aug 6, 2018
kristw added a commit to kristw/incubator-superset that referenced this pull request Aug 9, 2018
* Add option to not start y-axis at 0

* Update language to positive.

(cherry picked from commit aa14bac)
@kristw kristw deleted the kristw/trendline-range branch August 13, 2018 20:59
@kristw kristw restored the kristw/trendline-range branch August 13, 2018 20:59
@kristw kristw deleted the kristw/trendline-range branch August 13, 2018 20:59
wenchma pushed a commit to wenchma/incubator-superset that referenced this pull request Nov 16, 2018
* Add option to not start y-axis at 0

* Update language to positive.
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants