ghulands closed pull request #4154: #4153 Fix for sorting distribution charts
URL: https://github.com/apache/incubator-superset/pull/4154
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx
b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx
index 835cc1a3be..4a24fe1e24 100644
--- a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx
+++ b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx
@@ -95,9 +95,14 @@ class ExploreViewContainer extends React.Component {
}
triggerQueryIfNeeded() {
+<<<<<<< HEAD
+ if (this.props.triggerQuery && !this.hasErrors()) {
+ this.props.actions.runQuery(this.props.form_data, true,
this.props.timeout);
+=======
if (this.props.chart.triggerQuery && !this.hasErrors()) {
this.props.actions.runQuery(this.props.form_data, false,
this.props.timeout, this.props.chart.chartKey);
+>>>>>>> 3a8af5d0b049e1f5e7d70a8642984ddba4d70ba5
}
}
diff --git a/superset/assets/visualizations/nvd3_vis.js
b/superset/assets/visualizations/nvd3_vis.js
index 470f499094..9e0ad6e107 100644
--- a/superset/assets/visualizations/nvd3_vis.js
+++ b/superset/assets/visualizations/nvd3_vis.js
@@ -218,9 +218,11 @@ function nvd3Vis(slice, payload) {
stacked = fd.bar_stacked;
chart.stacked(stacked);
if (fd.order_bars) {
- data.forEach((d) => {
- d.values.sort((a, b) => tryNumify(a.x) < tryNumify(b.x) ? -1 : 1);
- });
+ // we sort the x-values from the first dataset so multiple dist_bar
+ // charts on a dashboard sort the same way.
+ data[0].values.sort(
+ (a, b) => a.x < b.x ? -1 : 1
+ );
}
if (fd.show_bar_value) {
setTimeout(function () {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services