You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/08/02 20:36:28 UTC
[superset] branch master updated: chore: change Sort-by and Sort-Descending controls for Bar Chart v2 (#20868)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7beda3bbdb chore: change Sort-by and Sort-Descending controls for Bar Chart v2 (#20868)
7beda3bbdb is described below
commit 7beda3bbdb3a0c4fe5f80ebdad7c0c449a981c73
Author: Stephen Liu <75...@qq.com>
AuthorDate: Wed Aug 3 04:36:21 2022 +0800
chore: change Sort-by and Sort-Descending controls for Bar Chart v2 (#20868)
---
.../src/Timeseries/Regular/Bar/controlPanel.tsx | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
index 5d30ee37e0..d5e8fcdee9 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx
@@ -328,6 +328,35 @@ const config: ControlPanelConfig = {
row_limit: {
default: rowLimit,
},
+ limit: {
+ rerender: ['timeseries_limit_metric', 'order_desc'],
+ },
+ timeseries_limit_metric: {
+ label: t('Series Limit Sort By'),
+ description: t(
+ 'Metric used to order the limit if a series limit is present. ' +
+ 'If undefined reverts to the first metric (where appropriate).',
+ ),
+ visibility: ({ controls }) => Boolean(controls?.limit.value),
+ mapStateToProps: (state, controlState) => {
+ const timeserieslimitProps =
+ sharedControls.timeseries_limit_metric.mapStateToProps?.(
+ state,
+ controlState,
+ ) || {};
+ timeserieslimitProps.value = state.controls?.limit?.value
+ ? controlState.value
+ : [];
+ return timeserieslimitProps;
+ },
+ },
+ order_desc: {
+ label: t('Series Limit Sort Descending'),
+ default: false,
+ description: t(
+ 'Whether to sort descending or ascending if a series limit is present',
+ ),
+ },
},
formDataOverrides: formData => ({
...formData,