You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/02/02 08:25:35 UTC

[superset] 01/03: add order by for bar charts (#12661)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit b90ac851adc223122ea4f27e380386bea230361d
Author: bryanck <br...@gmail.com>
AuthorDate: Thu Jan 21 23:00:58 2021 -0800

    add order by for bar charts (#12661)
    
    Co-authored-by: Bryan Keller <bk...@netflix.com>
---
 superset/viz.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/superset/viz.py b/superset/viz.py
index 37fb490..7d9a7bb 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1684,6 +1684,7 @@ class DistributionBarViz(BaseViz):
             raise QueryObjectValidationError(_("Pick at least one metric"))
         if not fd.get("groupby"):
             raise QueryObjectValidationError(_("Pick at least one field for [Series]"))
+        d["orderby"] = [(d["metrics"][0], False)]
         return d
 
     def get_data(self, df: pd.DataFrame) -> VizData: