From 28e87a9ece9b8ad5fb853afbc2e5d968949d63e0 Mon Sep 17 00:00:00 2001 From: geido Date: Tue, 12 Oct 2021 17:17:27 +0000 Subject: [PATCH 1/9] Replace color in scheme statically --- .../src/color/CategoricalColorNamespace.ts | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts index d531aee081..a4efb94e9e 100644 --- a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts +++ b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts @@ -12,22 +12,25 @@ export default class CategoricalColorNamespace { [key: string]: CategoricalColorScale; }; + schemeColors: { + [key: string]: { + [key: string]: string; + }; + }; + constructor(name: string) { this.name = name; this.scales = {}; this.forcedItems = {}; + this.schemeColors = {}; } getScale(schemeId?: string) { const id = schemeId ?? getCategoricalSchemeRegistry().getDefaultKey() ?? ''; - const scale = this.scales[id]; - if (scale) { - return scale; - } const scheme = getCategoricalSchemeRegistry().get(id); - - const newScale = new CategoricalColorScale(scheme?.colors ?? [], this.forcedItems); - this.scales[id] = newScale; + const forcedColors = { ...this.forcedItems, ...(this.schemeColors?.[id] || {}) }; + console.log('forcedColors', forcedColors); + const newScale = new CategoricalColorScale(scheme?.colors ?? [], forcedColors); return newScale; } @@ -44,6 +47,18 @@ export default class CategoricalColorNamespace { return this; } + + /* + Statically map specific colors to specific values for a color scheme. + Especially useful for custom label colors + */ + setSchemeColor(scheme: string, name: string, color: string) { + if (!this.schemeColors[scheme]) { + this.schemeColors[scheme] = {}; + } + + this.schemeColors[scheme][name] = color; + } } const namespaces: { @@ -70,3 +85,7 @@ export function getColor(value?: string, schemeId?: string, namespace?: string) export function getScale(scheme?: string, namespace?: string) { return getNamespace(namespace).getScale(scheme); } + +export function setSchemeColor(scheme: string, namespace: string, name: string, color: string) { + return getNamespace(namespace).setSchemeColor(scheme, name, color); +} From 1d4b0edc2da74d3d606a7755343e4463c9d96aec Mon Sep 17 00:00:00 2001 From: geido Date: Wed, 13 Oct 2021 14:26:56 +0000 Subject: [PATCH 2/9] Set color statically and re-use instance --- .../src/color/CategoricalColorNamespace.ts | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts index a4efb94e9e..e5992d06d8 100644 --- a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts +++ b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts @@ -25,12 +25,17 @@ export default class CategoricalColorNamespace { this.schemeColors = {}; } - getScale(schemeId?: string) { + getScale(schemeId?: string, existingScale?: boolean) { const id = schemeId ?? getCategoricalSchemeRegistry().getDefaultKey() ?? ''; const scheme = getCategoricalSchemeRegistry().get(id); const forcedColors = { ...this.forcedItems, ...(this.schemeColors?.[id] || {}) }; - console.log('forcedColors', forcedColors); + + if (existingScale && this.scales[id]) { + return this.scales[id]; + } + const newScale = new CategoricalColorScale(scheme?.colors ?? [], forcedColors); + this.scales[id] = newScale; return newScale; } @@ -48,10 +53,6 @@ export default class CategoricalColorNamespace { return this; } - /* - Statically map specific colors to specific values for a color scheme. - Especially useful for custom label colors - */ setSchemeColor(scheme: string, name: string, color: string) { if (!this.schemeColors[scheme]) { this.schemeColors[scheme] = {}; @@ -82,10 +83,28 @@ export function getColor(value?: string, schemeId?: string, namespace?: string) return getNamespace(namespace).getScale(schemeId).getColor(value); } +/* + Returns a new scale instance. + Especially useful when a chart is booting or when an existing + color scale instance is not necessary +*/ export function getScale(scheme?: string, namespace?: string) { return getNamespace(namespace).getScale(scheme); } +/* + Returns an existing color scale instance. + Especially useful when a chart has booted already and the existing + color scale instance should be used +*/ +export function getExistingScale(scheme?: string, namespace?: string) { + return getNamespace(namespace).getScale(scheme, true); +} + +/* + Statically map specific colors to specific values for a color scheme. + Especially useful for custom label colors +*/ export function setSchemeColor(scheme: string, namespace: string, name: string, color: string) { return getNamespace(namespace).setSchemeColor(scheme, name, color); } From 37cd1e2aa360f619e69c1adba509605af8eb7d04 Mon Sep 17 00:00:00 2001 From: geido Date: Wed, 13 Oct 2021 15:16:06 +0000 Subject: [PATCH 3/9] Fix tests and clean up --- .../src/color/CategoricalColorNamespace.ts | 6 +++--- .../test/color/CategoricalColorNameSpace.test.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts index e5992d06d8..bf585739b1 100644 --- a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts +++ b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts @@ -84,9 +84,9 @@ export function getColor(value?: string, schemeId?: string, namespace?: string) } /* - Returns a new scale instance. - Especially useful when a chart is booting or when an existing - color scale instance is not necessary + Returns a new scale instance even within the same namespace. + Especially useful when a chart is booting for the first time or when an existing + color scale instance should not be used even within the same namespace */ export function getScale(scheme?: string, namespace?: string) { return getNamespace(namespace).getScale(scheme); diff --git a/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts b/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts index fa2f193906..a5d80dc681 100644 --- a/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts +++ b/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts @@ -1,5 +1,6 @@ import CategoricalColorNamespace, { getNamespace, + getExistingScale, getScale, getColor, DEFAULT_NAMESPACE, @@ -63,11 +64,10 @@ describe('CategoricalColorNamespace', () => { getCategoricalSchemeRegistry().setDefaultKey('testColors'); }); it('returns same scale if the scale with that name already exists in this namespace', () => { - const namespace = getNamespace('test-get-scale2'); - const scale1 = namespace.getScale('testColors'); - const scale2 = namespace.getScale('testColors2'); - const scale3 = namespace.getScale('testColors2'); - const scale4 = namespace.getScale('testColors'); + const scale1 = getExistingScale('testColors', 'test-get-scale2'); + const scale2 = getExistingScale('testColors2', 'test-get-scale2'); + const scale3 = getExistingScale('testColors2', 'test-get-scale2'); + const scale4 = getExistingScale('testColors', 'test-get-scale2'); expect(scale1).toBe(scale4); expect(scale2).toBe(scale3); }); @@ -107,19 +107,19 @@ describe('CategoricalColorNamespace', () => { it('getScale() returns a CategoricalColorScale with default scheme in default namespace', () => { const scale = getScale(); expect(scale).toBeDefined(); - const scale2 = getNamespace().getScale(); + const scale2 = getExistingScale(); expect(scale).toBe(scale2); }); it('getScale(scheme) returns a CategoricalColorScale with specified scheme in default namespace', () => { const scale = getScale('testColors'); expect(scale).toBeDefined(); - const scale2 = getNamespace().getScale('testColors'); + const scale2 = getExistingScale('testColors'); expect(scale).toBe(scale2); }); it('getScale(scheme, namespace) returns a CategoricalColorScale with specified scheme in specified namespace', () => { const scale = getScale('testColors', 'test-getScale'); expect(scale).toBeDefined(); - const scale2 = getNamespace('test-getScale').getScale('testColors'); + const scale2 = getExistingScale('testColors', 'test-getScale'); expect(scale).toBe(scale2); }); }); From 1e85a6ee831c0de362afd2f3a7fdecf1ff263a07 Mon Sep 17 00:00:00 2001 From: geido Date: Wed, 13 Oct 2021 16:55:03 +0000 Subject: [PATCH 4/9] Improve comments --- .../src/color/CategoricalColorNamespace.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts index bf585739b1..cd67d6c0e3 100644 --- a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts +++ b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts @@ -84,9 +84,8 @@ export function getColor(value?: string, schemeId?: string, namespace?: string) } /* - Returns a new scale instance even within the same namespace. - Especially useful when a chart is booting for the first time or when an existing - color scale instance should not be used even within the same namespace + Returns a new scale instance within the same namespace. + Especially useful when a chart is booting for the first time */ export function getScale(scheme?: string, namespace?: string) { return getNamespace(namespace).getScale(scheme); @@ -102,7 +101,7 @@ export function getExistingScale(scheme?: string, namespace?: string) { } /* - Statically map specific colors to specific values for a color scheme. + Map specific colors to specific values for a color scheme within a namespace. Especially useful for custom label colors */ export function setSchemeColor(scheme: string, namespace: string, name: string, color: string) { From f47b2d3db8aa491d90964ed0fb4569be7f0aff4d Mon Sep 17 00:00:00 2001 From: geido Date: Fri, 15 Oct 2021 15:18:24 +0000 Subject: [PATCH 5/9] Refactor and simplify --- .../src/color/CategoricalColorNamespace.ts | 42 ++----------------- .../src/color/CategoricalColorScale.ts | 2 - .../color/CategoricalColorNameSpace.test.ts | 15 +++---- 3 files changed, 12 insertions(+), 47 deletions(-) diff --git a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts index cd67d6c0e3..ac24db80ea 100644 --- a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts +++ b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts @@ -12,30 +12,17 @@ export default class CategoricalColorNamespace { [key: string]: CategoricalColorScale; }; - schemeColors: { - [key: string]: { - [key: string]: string; - }; - }; - constructor(name: string) { this.name = name; this.scales = {}; this.forcedItems = {}; - this.schemeColors = {}; } - getScale(schemeId?: string, existingScale?: boolean) { + getScale(schemeId?: string) { const id = schemeId ?? getCategoricalSchemeRegistry().getDefaultKey() ?? ''; const scheme = getCategoricalSchemeRegistry().get(id); - const forcedColors = { ...this.forcedItems, ...(this.schemeColors?.[id] || {}) }; - - if (existingScale && this.scales[id]) { - return this.scales[id]; - } - + const forcedColors = this.forcedItems; const newScale = new CategoricalColorScale(scheme?.colors ?? [], forcedColors); - this.scales[id] = newScale; return newScale; } @@ -53,12 +40,8 @@ export default class CategoricalColorNamespace { return this; } - setSchemeColor(scheme: string, name: string, color: string) { - if (!this.schemeColors[scheme]) { - this.schemeColors[scheme] = {}; - } - - this.schemeColors[scheme][name] = color; + resetColors() { + this.forcedItems = {}; } } @@ -90,20 +73,3 @@ export function getColor(value?: string, schemeId?: string, namespace?: string) export function getScale(scheme?: string, namespace?: string) { return getNamespace(namespace).getScale(scheme); } - -/* - Returns an existing color scale instance. - Especially useful when a chart has booted already and the existing - color scale instance should be used -*/ -export function getExistingScale(scheme?: string, namespace?: string) { - return getNamespace(namespace).getScale(scheme, true); -} - -/* - Map specific colors to specific values for a color scheme within a namespace. - Especially useful for custom label colors -*/ -export function setSchemeColor(scheme: string, namespace: string, name: string, color: string) { - return getNamespace(namespace).setSchemeColor(scheme, name, color); -} diff --git a/packages/superset-ui-core/src/color/CategoricalColorScale.ts b/packages/superset-ui-core/src/color/CategoricalColorScale.ts index 6616706ab2..f84bc122cf 100644 --- a/packages/superset-ui-core/src/color/CategoricalColorScale.ts +++ b/packages/superset-ui-core/src/color/CategoricalColorScale.ts @@ -38,7 +38,6 @@ class CategoricalColorScale extends ExtensibleFunction { getColor(value?: string) { const cleanedValue = stringifyAndTrim(value); - const parentColor = this.parentForcedColors && this.parentForcedColors[cleanedValue]; if (parentColor) { return parentColor; @@ -59,7 +58,6 @@ class CategoricalColorScale extends ExtensibleFunction { */ setColor(value: string, forcedColor: string) { this.forcedColors[stringifyAndTrim(value)] = forcedColor; - return this; } diff --git a/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts b/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts index a5d80dc681..5e0e2435fb 100644 --- a/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts +++ b/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts @@ -64,10 +64,11 @@ describe('CategoricalColorNamespace', () => { getCategoricalSchemeRegistry().setDefaultKey('testColors'); }); it('returns same scale if the scale with that name already exists in this namespace', () => { - const scale1 = getExistingScale('testColors', 'test-get-scale2'); - const scale2 = getExistingScale('testColors2', 'test-get-scale2'); - const scale3 = getExistingScale('testColors2', 'test-get-scale2'); - const scale4 = getExistingScale('testColors', 'test-get-scale2'); + const namespace = getNamespace('test-get-scale2'); + const scale1 = namespace.getScale('testColors'); + const scale2 = namespace.getScale('testColors2'); + const scale3 = namespace.getScale('testColors2'); + const scale4 = namespace.getScale('testColors'); expect(scale1).toBe(scale4); expect(scale2).toBe(scale3); }); @@ -107,19 +108,19 @@ describe('CategoricalColorNamespace', () => { it('getScale() returns a CategoricalColorScale with default scheme in default namespace', () => { const scale = getScale(); expect(scale).toBeDefined(); - const scale2 = getExistingScale(); + const scale2 = getNamespace().getScale(); expect(scale).toBe(scale2); }); it('getScale(scheme) returns a CategoricalColorScale with specified scheme in default namespace', () => { const scale = getScale('testColors'); expect(scale).toBeDefined(); - const scale2 = getExistingScale('testColors'); + const scale2 = getNamespace().getScale('testColors'); expect(scale).toBe(scale2); }); it('getScale(scheme, namespace) returns a CategoricalColorScale with specified scheme in specified namespace', () => { const scale = getScale('testColors', 'test-getScale'); expect(scale).toBeDefined(); - const scale2 = getExistingScale('testColors', 'test-getScale'); + const scale2 = getNamespace('test-getScale').getScale('testColors'); expect(scale).toBe(scale2); }); }); From 3d966e9d3c68e69f9987ebfb621b458275d4bfb7 Mon Sep 17 00:00:00 2001 From: geido Date: Fri, 15 Oct 2021 15:25:51 +0000 Subject: [PATCH 6/9] Update tests --- .../color/CategoricalColorNameSpace.test.ts | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts b/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts index 5e0e2435fb..9c1b6b1200 100644 --- a/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts +++ b/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts @@ -1,6 +1,5 @@ import CategoricalColorNamespace, { getNamespace, - getExistingScale, getScale, getColor, DEFAULT_NAMESPACE, @@ -63,15 +62,6 @@ describe('CategoricalColorNamespace', () => { expect(scale).toBeDefined(); getCategoricalSchemeRegistry().setDefaultKey('testColors'); }); - it('returns same scale if the scale with that name already exists in this namespace', () => { - const namespace = getNamespace('test-get-scale2'); - const scale1 = namespace.getScale('testColors'); - const scale2 = namespace.getScale('testColors2'); - const scale3 = namespace.getScale('testColors2'); - const scale4 = namespace.getScale('testColors'); - expect(scale1).toBe(scale4); - expect(scale2).toBe(scale3); - }); }); describe('.setColor()', () => { it('overwrites color for all CategoricalColorScales in this namespace', () => { @@ -109,19 +99,15 @@ describe('CategoricalColorNamespace', () => { const scale = getScale(); expect(scale).toBeDefined(); const scale2 = getNamespace().getScale(); - expect(scale).toBe(scale2); + expect(scale2).toBeDefined(); }); it('getScale(scheme) returns a CategoricalColorScale with specified scheme in default namespace', () => { - const scale = getScale('testColors'); + const scale = getNamespace().getScale('testColors'); expect(scale).toBeDefined(); - const scale2 = getNamespace().getScale('testColors'); - expect(scale).toBe(scale2); }); it('getScale(scheme, namespace) returns a CategoricalColorScale with specified scheme in specified namespace', () => { - const scale = getScale('testColors', 'test-getScale'); + const scale = getNamespace('test-getScale').getScale('testColors'); expect(scale).toBeDefined(); - const scale2 = getNamespace('test-getScale').getScale('testColors'); - expect(scale).toBe(scale2); }); }); describe('static getColor()', () => { From 499db4956ddcda66bfb8b5c0b78634bc60bf4374 Mon Sep 17 00:00:00 2001 From: geido Date: Mon, 18 Oct 2021 15:31:18 +0000 Subject: [PATCH 7/9] Remove unnecessary ColorMapControl --- .../src/shared-controls/index.tsx | 14 -------------- packages/superset-ui-chart-controls/src/types.ts | 1 - 2 files changed, 15 deletions(-) diff --git a/packages/superset-ui-chart-controls/src/shared-controls/index.tsx b/packages/superset-ui-chart-controls/src/shared-controls/index.tsx index 191953f2aa..9975a444bf 100644 --- a/packages/superset-ui-chart-controls/src/shared-controls/index.tsx +++ b/packages/superset-ui-chart-controls/src/shared-controls/index.tsx @@ -464,19 +464,6 @@ const color_scheme: SharedControlConfig<'ColorSchemeControl'> = { schemes: () => categoricalSchemeRegistry.getMap(), }; -const label_colors: SharedControlConfig<'ColorMapControl'> = { - type: 'ColorMapControl', - label: t('Color Map'), - default: {}, - renderTrigger: true, - mapStateToProps: ({ - form_data: { color_namespace: colorNamespace, color_scheme: colorScheme }, - }) => ({ - colorNamespace, - colorScheme, - }), -}; - const enableExploreDnd = isFeatureEnabled(FeatureFlag.ENABLE_EXPLORE_DRAG_AND_DROP); const sharedControls = { @@ -508,7 +495,6 @@ const sharedControls = { x_axis_time_format, adhoc_filters: enableExploreDnd ? dnd_adhoc_filters : adhoc_filters, color_scheme, - label_colors, series_columns: enableExploreDnd ? dndColumnsControl : columnsControl, series_limit, series_limit_metric: enableExploreDnd ? dnd_sort_by : sort_by, diff --git a/packages/superset-ui-chart-controls/src/types.ts b/packages/superset-ui-chart-controls/src/types.ts index 4a59ca5602..3aa54242b3 100644 --- a/packages/superset-ui-chart-controls/src/types.ts +++ b/packages/superset-ui-chart-controls/src/types.ts @@ -116,7 +116,6 @@ export type InternalControlType = | 'BoundsControl' | 'CheckboxControl' | 'CollectionControl' - | 'ColorMapControl' | 'ColorPickerControl' | 'ColorSchemeControl' | 'DatasourceControl' From 253399bf05c7cf52c6e3a3046c7517bffeacbc92 Mon Sep 17 00:00:00 2001 From: geido Date: Fri, 22 Oct 2021 09:52:52 +0000 Subject: [PATCH 8/9] Remove unnecessary const --- .../superset-ui-core/src/color/CategoricalColorNamespace.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts index ac24db80ea..251472bce4 100644 --- a/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts +++ b/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts @@ -21,8 +21,7 @@ export default class CategoricalColorNamespace { getScale(schemeId?: string) { const id = schemeId ?? getCategoricalSchemeRegistry().getDefaultKey() ?? ''; const scheme = getCategoricalSchemeRegistry().get(id); - const forcedColors = this.forcedItems; - const newScale = new CategoricalColorScale(scheme?.colors ?? [], forcedColors); + const newScale = new CategoricalColorScale(scheme?.colors ?? [], this.forcedItems); return newScale; } From 38909cb107cd5db1a583a151065c3505866dac3e Mon Sep 17 00:00:00 2001 From: geido Date: Mon, 25 Oct 2021 11:58:26 +0000 Subject: [PATCH 9/9] Remove control label_colors --- .../superset-ui-chart-controls/src/sections/sections.tsx | 2 +- plugins/legacy-plugin-chart-chord/src/controlPanel.ts | 5 +---- plugins/legacy-plugin-chart-histogram/src/controlPanel.ts | 2 +- plugins/legacy-plugin-chart-partition/src/controlPanel.tsx | 2 +- plugins/legacy-plugin-chart-rose/src/controlPanel.tsx | 2 +- plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts | 2 +- plugins/legacy-plugin-chart-sankey/src/controlPanel.ts | 2 +- plugins/legacy-plugin-chart-treemap/src/controlPanel.ts | 2 +- plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts | 2 +- plugins/legacy-preset-chart-nvd3/src/Bar/controlPanel.ts | 1 - plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts | 5 +---- plugins/legacy-preset-chart-nvd3/src/Compare/controlPanel.ts | 2 +- plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts | 1 - .../legacy-preset-chart-nvd3/src/DualLine/controlPanel.ts | 2 +- plugins/legacy-preset-chart-nvd3/src/Line/controlPanel.ts | 1 - .../legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts | 2 +- plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts | 2 +- .../src/MixedTimeseries/controlPanel.tsx | 2 +- .../src/Timeseries/Area/controlPanel.tsx | 2 +- .../src/Timeseries/Regular/Scatter/controlPanel.tsx | 2 +- .../src/Timeseries/Regular/controlPanel.tsx | 2 +- .../src/Timeseries/Step/controlPanel.tsx | 2 +- plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx | 2 +- plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts | 2 +- plugins/preset-chart-xy/src/BoxPlot/controlPanel.ts | 2 +- 25 files changed, 22 insertions(+), 31 deletions(-) diff --git a/packages/superset-ui-chart-controls/src/sections/sections.tsx b/packages/superset-ui-chart-controls/src/sections/sections.tsx index eb93c469df..53ac2ae2ff 100644 --- a/packages/superset-ui-chart-controls/src/sections/sections.tsx +++ b/packages/superset-ui-chart-controls/src/sections/sections.tsx @@ -104,7 +104,7 @@ export const datasourceAndVizType: ControlPanelSectionConfig = { export const colorScheme: ControlPanelSectionConfig = { label: t('Color Scheme'), - controlSetRows: [['color_scheme', 'label_colors']], + controlSetRows: [['color_scheme']], }; export const annotations: ControlPanelSectionConfig = { diff --git a/plugins/legacy-plugin-chart-chord/src/controlPanel.ts b/plugins/legacy-plugin-chart-chord/src/controlPanel.ts index c37332e1e7..73ae97f225 100644 --- a/plugins/legacy-plugin-chart-chord/src/controlPanel.ts +++ b/plugins/legacy-plugin-chart-chord/src/controlPanel.ts @@ -46,10 +46,7 @@ const config: ControlPanelConfig = { { label: t('Chart Options'), expanded: true, - controlSetRows: [ - ['y_axis_format', null], - ['color_scheme', 'label_colors'], - ], + controlSetRows: [['y_axis_format', null], ['color_scheme']], }, ], controlOverrides: { diff --git a/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts b/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts index 2dd936d5d6..b2de53cbc8 100644 --- a/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts +++ b/plugins/legacy-plugin-chart-histogram/src/controlPanel.ts @@ -70,7 +70,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'link_length', diff --git a/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx b/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx index 8c21396035..7da0d93e3a 100644 --- a/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx +++ b/plugins/legacy-plugin-chart-partition/src/controlPanel.tsx @@ -131,7 +131,7 @@ const config: ControlPanelConfig = { expanded: true, tabOverride: 'customize', controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'number_format', diff --git a/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx b/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx index 960ce13726..d4dde69341 100644 --- a/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx +++ b/plugins/legacy-plugin-chart-rose/src/controlPanel.tsx @@ -65,7 +65,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'number_format', diff --git a/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts b/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts index f659aa51a5..0b2c8a0e55 100644 --- a/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts +++ b/plugins/legacy-plugin-chart-sankey-loop/src/controlPanel.ts @@ -30,7 +30,7 @@ const config: ControlPanelConfig = { { label: t('Chart Options'), expanded: true, - controlSetRows: [['color_scheme', 'label_colors']], + controlSetRows: [['color_scheme']], }, ], controlOverrides: { diff --git a/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts b/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts index 1386d45500..7c7a2a5db9 100644 --- a/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts +++ b/plugins/legacy-plugin-chart-sankey/src/controlPanel.ts @@ -62,7 +62,7 @@ const config: ControlPanelConfig = { { label: t('Chart Options'), expanded: true, - controlSetRows: [['color_scheme', 'label_colors']], + controlSetRows: [['color_scheme']], }, ], }; diff --git a/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts b/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts index 24487dc238..9726396013 100644 --- a/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts +++ b/plugins/legacy-plugin-chart-treemap/src/controlPanel.ts @@ -54,7 +54,7 @@ const config: ControlPanelConfig = { expanded: true, tabOverride: 'customize', controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'treemap_ratio', diff --git a/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts index 204770ff74..c3c08a23c0 100644 --- a/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts @@ -61,7 +61,7 @@ const config: ControlPanelConfig = { }, }, ], - ['color_scheme', 'label_colors'], + ['color_scheme'], [richTooltip, showControls], ], }, diff --git a/plugins/legacy-preset-chart-nvd3/src/Bar/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/Bar/controlPanel.ts index c9e6595baa..d53ad9fcf5 100644 --- a/plugins/legacy-preset-chart-nvd3/src/Bar/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/Bar/controlPanel.ts @@ -49,7 +49,6 @@ const config: ControlPanelConfig = { expanded: true, controlSetRows: [ ['color_scheme'], - ['label_colors'], [showBrush], [showLegend], [showBarValue], diff --git a/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts index acf001e823..5dc3e97b30 100644 --- a/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts @@ -69,10 +69,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, tabOverride: 'customize', - controlSetRows: [ - ['color_scheme', 'label_colors'], - [showLegend, null], - ], + controlSetRows: [['color_scheme'], [showLegend, null]], }, { label: t('X Axis'), diff --git a/plugins/legacy-preset-chart-nvd3/src/Compare/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/Compare/controlPanel.ts index 0a68fe8e44..db4a84fd47 100644 --- a/plugins/legacy-preset-chart-nvd3/src/Compare/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/Compare/controlPanel.ts @@ -39,7 +39,7 @@ const config: ControlPanelConfig = { { label: t('Chart Options'), expanded: true, - controlSetRows: [['color_scheme', 'label_colors']], + controlSetRows: [['color_scheme']], }, { label: t('X Axis'), diff --git a/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts index 2adf7376d8..923a2bfc05 100644 --- a/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/DistBar/controlPanel.ts @@ -79,7 +79,6 @@ const config: ControlPanelConfig = { expanded: true, controlSetRows: [ ['color_scheme'], - ['label_colors'], [showLegend], [showBarValue], [barStacked], diff --git a/plugins/legacy-preset-chart-nvd3/src/DualLine/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/DualLine/controlPanel.ts index 8173536122..1c01cb4758 100644 --- a/plugins/legacy-preset-chart-nvd3/src/DualLine/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/DualLine/controlPanel.ts @@ -34,7 +34,7 @@ const config: ControlPanelConfig = { { label: t('Chart Options'), expanded: true, - controlSetRows: [['color_scheme', 'label_colors'], [showLegend], [xAxisFormat]], + controlSetRows: [['color_scheme'], [showLegend], [xAxisFormat]], }, { label: t('Y Axis 1'), diff --git a/plugins/legacy-preset-chart-nvd3/src/Line/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/Line/controlPanel.ts index 7815375ec9..5b277cf671 100644 --- a/plugins/legacy-preset-chart-nvd3/src/Line/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/Line/controlPanel.ts @@ -46,7 +46,6 @@ const config: ControlPanelConfig = { expanded: true, controlSetRows: [ ['color_scheme'], - ['label_colors'], [showBrush], [ { diff --git a/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts index f6b9c7d8cb..488b020198 100644 --- a/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/LineMulti/controlPanel.ts @@ -55,7 +55,7 @@ const config: ControlPanelConfig = { tabOverride: 'customize', expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'prefix_metric_with_slice_name', diff --git a/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts b/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts index 9cf3232270..05baeb63d9 100644 --- a/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts +++ b/plugins/legacy-preset-chart-nvd3/src/Pie/controlPanel.ts @@ -103,7 +103,7 @@ const config: ControlPanelConfig = { }, }, ], - ['color_scheme', 'label_colors'], + ['color_scheme'], ], }, ], diff --git a/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx b/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx index e79ae52da4..d9170f3cac 100644 --- a/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx +++ b/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx @@ -252,7 +252,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], ...createCustomizeSection(t('Query A'), ''), ...createCustomizeSection(t('Query B'), 'B'), [ diff --git a/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx b/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx index 4abe8bbedf..7f22cd7fd2 100644 --- a/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx +++ b/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx @@ -100,7 +100,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'seriesType', diff --git a/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx b/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx index b66b8a477e..a48a790c79 100644 --- a/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx +++ b/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx @@ -77,7 +77,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], ...showValueSection, [ { diff --git a/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx b/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx index cd201ad382..bac1848f7c 100644 --- a/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx +++ b/plugins/plugin-chart-echarts/src/Timeseries/Regular/controlPanel.tsx @@ -94,7 +94,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], ...showValueSection, [ { diff --git a/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx b/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx index f91aa68b21..a21cb54d2c 100644 --- a/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx +++ b/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx @@ -100,7 +100,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'seriesType', diff --git a/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx b/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx index c497f8e759..d0ba405039 100644 --- a/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx +++ b/plugins/plugin-chart-echarts/src/Timeseries/controlPanel.tsx @@ -101,7 +101,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'seriesType', diff --git a/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts b/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts index 715d9eb120..6deb658ebb 100644 --- a/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts +++ b/plugins/plugin-chart-word-cloud/src/plugin/controlPanel.ts @@ -88,7 +88,7 @@ const config: ControlPanelConfig = { }, }, ], - ['color_scheme', 'label_colors'], + ['color_scheme'], ], }, ], diff --git a/plugins/preset-chart-xy/src/BoxPlot/controlPanel.ts b/plugins/preset-chart-xy/src/BoxPlot/controlPanel.ts index 6ed2d2f970..599390baae 100644 --- a/plugins/preset-chart-xy/src/BoxPlot/controlPanel.ts +++ b/plugins/preset-chart-xy/src/BoxPlot/controlPanel.ts @@ -31,7 +31,7 @@ const config: ControlPanelConfig = { label: t('Chart Options'), expanded: true, controlSetRows: [ - ['color_scheme', 'label_colors'], + ['color_scheme'], [ { name: 'whisker_options',