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

Added checkbox in dist_bar viz to enable sorting of bars based on x axis labels #1379

Merged
merged 3 commits into from
Oct 28, 2016

Conversation

vera-liu
Copy link
Contributor

@vera-liu vera-liu commented Oct 19, 2016

Done:

  • Added a checkbox for dist_bar viz
  • Once toggled, distribution bars are ordered according to their x axis labels

Issue:
#519

Checkbox:
screen shot 2016-10-20 at 2 52 54 pm

Before ordering:
screen shot 2016-10-19 at 2 42 01 pm

After toggling checkbox and click 'Query' button:
screen shot 2016-10-19 at 2 42 18 pm

needs-review @mistercrunch @ascott

@@ -1316,6 +1316,7 @@ class DistributionBarViz(DistributionPieViz):
('y_axis_format', 'bottom_margin'),
('x_axis_label', 'y_axis_label'),
('reduce_x_ticks', 'contribution'),
('order_bars'),
Copy link
Member

Choose a reason for hiding this comment

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

('order_bars', None) will render using half the column so that the checkbox is not too far away from the label.

'order_bars': (BetterBooleanField, {
"label": _("Sort Bars"),
"default": False,
"description": "Sort bars by x labels"
Copy link
Member

Choose a reason for hiding this comment

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

_("Sort bars by x labels"), for translation, and don't forget the trailing comma

@vera-liu
Copy link
Contributor Author

Updated checkbox and tooltip message @mistercrunch

@vera-liu
Copy link
Contributor Author

I have a question about this logic: https://github.com/airbnb/caravel/blob/63161b11c347d5a6d62f7ae7dc91fa3c30b5dc93/caravel/models.py#L1093
Why is orderby only applied when groupby is not specified? Is it possible to change elif to if here, so that orderby specified metrics and groupby could happen at the same time?

@mistercrunch
Copy link
Member

LGTM!

@vera-liu vera-liu merged commit d2826ab into apache:master Oct 28, 2016
@vera-liu vera-liu deleted the vliu_dist_bar_order branch November 1, 2016 19:00
@hongqp
Copy link

hongqp commented Dec 16, 2016

Sorry @vera-liu . I used #1379, and already can saw the "Sort Bars" checkbox on the page. But when I checked it and re-query, there is nothing changed. How can I do if I want enable sorting of bars based on x axis labels in dist_bar.

default

@vera-liu
Copy link
Contributor Author

vera-liu commented Dec 16, 2016 via email

@hongqp
Copy link

hongqp commented Jan 9, 2017

@vera-liu ,yes,it work when I updated the file “explore.0.12.0.entry.js”.
Thanks a lot.

@ondrejkopicka
Copy link

@vera-liu unfortunately labels are sorted only alphabetically. In case of numeric labels the resulting order is 1, 10, 101, 11, 2, 21, 3 instead of 1, 2, 3, 10, 11, 21, 101.

@skysaeed
Copy link

skysaeed commented Jul 11, 2018

@vera-liu
there is a problem when sorting the labels like : 1, 2, 3, 4+
sometime it is sorted randomly

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.13.0 labels Feb 19, 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.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants