fix(plugin-chart-echarts): add orderby to funnel chart (#1099)

* fix(plugin-chart-echarts): add orderby

fix https://github.com/apache/superset/issues/14534

* feat(plugin-chart-echarts): set orderby default value is true
This commit is contained in:
gordern
2021-05-10 22:08:09 +08:00
committed by Yongjie Zhao
parent 8d45a17923
commit e994fc0802
2 changed files with 13 additions and 0 deletions

View File

@@ -19,9 +19,11 @@
import { buildQueryContext, QueryFormData } from '@superset-ui/core';
export default function buildQuery(formData: QueryFormData) {
const { metric, sort_by_metric } = formData;
return buildQueryContext(formData, baseQueryObject => [
{
...baseQueryObject,
...(sort_by_metric && { orderby: [[metric, false]] }),
},
]);
}

View File

@@ -57,6 +57,17 @@ const config: ControlPanelConfig = {
},
},
],
[
{
name: 'sort_by_metric',
config: {
default: true,
type: 'CheckboxControl',
label: t('Sort by metric'),
description: t('Whether to sort results by the selected metric in descending order.'),
},
},
],
],
},
{