mirror of https://github.com/apache/superset.git
feat(explore): Denormalize form data in echarts, world map and nvd3 bar and line charts (#20313)
* feat(explore): Apply denormalize form data function to echarts and world map * Denormalize form data in mixed timeseries * Add dist bar chart
This commit is contained in:
parent
d04357c47b
commit
354a89950c
|
@ -152,6 +152,10 @@ const config: ControlPanelConfig = {
|
||||||
Boolean(controls?.color_by.value === ColorBy.country),
|
Boolean(controls?.color_by.value === ColorBy.country),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -122,6 +122,11 @@ const config: ControlPanelConfig = {
|
||||||
timeSeriesSection[1],
|
timeSeriesSection[1],
|
||||||
sections.annotations,
|
sections.annotations,
|
||||||
],
|
],
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -106,7 +106,6 @@ const config: ControlPanelConfig = {
|
||||||
],
|
],
|
||||||
controlOverrides: {
|
controlOverrides: {
|
||||||
groupby: {
|
groupby: {
|
||||||
label: t('Dimensions'),
|
|
||||||
validators: [validateNonEmpty],
|
validators: [validateNonEmpty],
|
||||||
mapStateToProps: (state, controlState) => {
|
mapStateToProps: (state, controlState) => {
|
||||||
const groupbyProps =
|
const groupbyProps =
|
||||||
|
@ -134,6 +133,17 @@ const config: ControlPanelConfig = {
|
||||||
rerender: ['groupby'],
|
rerender: ['groupby'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => {
|
||||||
|
const columns =
|
||||||
|
formData.standardizedFormData.standardizedState.columns.filter(
|
||||||
|
col => !ensureIsArray(formData.groupby).includes(col),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
columns,
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -96,6 +96,11 @@ const config: ControlPanelConfig = {
|
||||||
default: 50000,
|
default: 50000,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import { t } from '@superset-ui/core';
|
import { ensureIsArray, t } from '@superset-ui/core';
|
||||||
import {
|
import {
|
||||||
D3_FORMAT_DOCS,
|
D3_FORMAT_DOCS,
|
||||||
D3_FORMAT_OPTIONS,
|
D3_FORMAT_OPTIONS,
|
||||||
|
@ -136,5 +136,16 @@ const config: ControlPanelConfig = {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => {
|
||||||
|
const groupby =
|
||||||
|
formData.standardizedFormData.standardizedState.columns.filter(
|
||||||
|
col => !ensureIsArray(formData.columns).includes(col),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby,
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -143,6 +143,11 @@ const config: ControlPanelConfig = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metric: formData.standardizedFormData.standardizedState.metrics[0],
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -39,7 +39,6 @@ const config: ControlPanelConfig = {
|
||||||
name: 'groupby',
|
name: 'groupby',
|
||||||
config: {
|
config: {
|
||||||
...sharedControls.groupby,
|
...sharedControls.groupby,
|
||||||
label: t('Dimensions'),
|
|
||||||
description: t('Columns to group by'),
|
description: t('Columns to group by'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -309,6 +308,11 @@ const config: ControlPanelConfig = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metric: formData.standardizedFormData.standardizedState.metrics[0],
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -320,6 +320,10 @@ const controlPanel: ControlPanelConfig = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metric: formData.standardizedFormData.standardizedState.metrics[0],
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default controlPanel;
|
export default controlPanel;
|
||||||
|
|
|
@ -17,7 +17,12 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FeatureFlag, isFeatureEnabled, t } from '@superset-ui/core';
|
import {
|
||||||
|
ensureIsArray,
|
||||||
|
FeatureFlag,
|
||||||
|
isFeatureEnabled,
|
||||||
|
t,
|
||||||
|
} from '@superset-ui/core';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import {
|
import {
|
||||||
ControlPanelConfig,
|
ControlPanelConfig,
|
||||||
|
@ -435,6 +440,21 @@ const config: ControlPanelConfig = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
denormalizeFormData: formData => {
|
||||||
|
const groupby =
|
||||||
|
formData.standardizedFormData.standardizedState.columns.filter(
|
||||||
|
col => !ensureIsArray(formData.groupby_b).includes(col),
|
||||||
|
);
|
||||||
|
const metrics =
|
||||||
|
formData.standardizedFormData.standardizedState.metrics.filter(
|
||||||
|
metric => !ensureIsArray(formData.metrics_b).includes(metric),
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
...formData,
|
||||||
|
metrics,
|
||||||
|
groupby,
|
||||||
|
};
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -210,6 +210,11 @@ const config: ControlPanelConfig = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -312,6 +312,11 @@ const config: ControlPanelConfig = {
|
||||||
default: rowLimit,
|
default: rowLimit,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -398,6 +398,11 @@ const config: ControlPanelConfig = {
|
||||||
default: rowLimit,
|
default: rowLimit,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -223,6 +223,11 @@ const config: ControlPanelConfig = {
|
||||||
default: rowLimit,
|
default: rowLimit,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -243,6 +243,7 @@ const config: ControlPanelConfig = {
|
||||||
denormalizeFormData: formData => ({
|
denormalizeFormData: formData => ({
|
||||||
...formData,
|
...formData,
|
||||||
metrics: formData.standardizedFormData.standardizedState.metrics,
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -296,6 +296,11 @@ const config: ControlPanelConfig = {
|
||||||
default: rowLimit,
|
default: rowLimit,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -299,6 +299,11 @@ const config: ControlPanelConfig = {
|
||||||
default: rowLimit,
|
default: rowLimit,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metrics: formData.standardizedFormData.standardizedState.metrics,
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
|
@ -285,6 +285,10 @@ const controlPanel: ControlPanelConfig = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metric: formData.standardizedFormData.standardizedState.metrics[0],
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default controlPanel;
|
export default controlPanel;
|
||||||
|
|
|
@ -137,6 +137,11 @@ const config: ControlPanelConfig = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
denormalizeFormData: formData => ({
|
||||||
|
...formData,
|
||||||
|
metric: formData.standardizedFormData.standardizedState.metrics[0],
|
||||||
|
groupby: formData.standardizedFormData.standardizedState.columns,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
|
Loading…
Reference in New Issue