fix(plugin-chart-echarts): boxplot throw error in the dashboard (#21661)

This commit is contained in:
Stephen Liu
2022-10-01 08:53:29 +08:00
committed by GitHub
parent 4c17f0e71e
commit 61bd696226
3 changed files with 9 additions and 5 deletions

View File

@@ -172,10 +172,14 @@ const config: ControlPanelConfig = {
label: t('Distribute across'),
multi: true,
description: t('Columns to calculate distribution across.'),
initialValue: (control: ControlState, state: ControlPanelState) => {
initialValue: (
control: ControlState,
state: ControlPanelState | null,
) => {
if (
(state && !control?.value) ||
(Array.isArray(control?.value) && control.value.length === 0)
state &&
(!control?.value ||
(Array.isArray(control?.value) && control.value.length === 0))
) {
return [getTemporalColumns(state.datasource).defaultTemporalColumn];
}