From 810bd5f9f89f1c52454a41a088b2b1c77f2d4f50 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Thu, 14 Nov 2024 13:00:37 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(admin)=20color=20scale=20contro?= =?UTF-8?q?ls=20are=20unresponsive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/stackedCharts/MarimekkoChart.tsx | 7 ++----- .../src/stackedCharts/StackedBarChart.tsx | 6 +----- .../types/src/grapherTypes/GrapherTypes.ts | 20 +++++++++---------- packages/@ourworldindata/types/src/index.ts | 1 - 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx index 80dbd3d45fa..b2f6627ccc1 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/MarimekkoChart.tsx @@ -40,7 +40,6 @@ import { EntityName, OwidVariableRow, OwidTableSlugs, - colorScaleConfigDefaults, VerticalAlign, } from "@ourworldindata/types" import { OwidTable, CoreColumn } from "@ourworldindata/core-table" @@ -504,10 +503,8 @@ export class MarimekkoChart @computed get colorScaleConfig(): ColorScaleConfigDefaults | undefined { return ( - ColorScaleConfig.fromDSL(this.colorColumn.def) ?? { - ...colorScaleConfigDefaults, - ...this.manager.colorScale, - } + ColorScaleConfig.fromDSL(this.colorColumn.def) ?? + this.manager.colorScale ) } diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/StackedBarChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/StackedBarChart.tsx index 8815c60b367..8c6f70c009a 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/StackedBarChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/StackedBarChart.tsx @@ -8,7 +8,6 @@ import { makeSafeForCSS, sum, getRelativeMouse, - colorScaleConfigDefaults, excludeUndefined, min, max, @@ -627,10 +626,7 @@ export class StackedBarChart } @computed get colorScaleConfig(): ColorScaleConfigDefaults | undefined { - return { - ...colorScaleConfigDefaults, - ...this.manager.colorScale, - } + return this.manager.colorScale } defaultBaseColorScheme = ColorSchemeName.stackedAreaDefault diff --git a/packages/@ourworldindata/types/src/grapherTypes/GrapherTypes.ts b/packages/@ourworldindata/types/src/grapherTypes/GrapherTypes.ts index 618c07588d8..72a958c57c8 100644 --- a/packages/@ourworldindata/types/src/grapherTypes/GrapherTypes.ts +++ b/packages/@ourworldindata/types/src/grapherTypes/GrapherTypes.ts @@ -410,16 +410,16 @@ export type ColorScaleConfigInterface = ColorScaleConfigDefaults // legendDescription?: string // } -export const colorScaleConfigDefaults = { - binningStrategy: BinningStrategy.ckmeans, - customNumericValues: [], - customNumericLabels: [], - customNumericColors: [], - equalSizeBins: true, - customCategoryColors: {}, - customCategoryLabels: {}, - customHiddenCategories: {}, -} satisfies ColorScaleConfigInterface +// export const colorScaleConfigDefaults = { +// binningStrategy: BinningStrategy.ckmeans, +// customNumericValues: [], +// customNumericLabels: [], +// customNumericColors: [], +// equalSizeBins: true, +// customCategoryColors: {}, +// customCategoryLabels: {}, +// customHiddenCategories: {}, +// } satisfies ColorScaleConfigInterface export interface ColorSchemeInterface { name: string diff --git a/packages/@ourworldindata/types/src/index.ts b/packages/@ourworldindata/types/src/index.ts index 5decf69e009..47793dae7df 100644 --- a/packages/@ourworldindata/types/src/index.ts +++ b/packages/@ourworldindata/types/src/index.ts @@ -73,7 +73,6 @@ export { BinningStrategy, type ColorScaleConfigInterface, ColorSchemeName, - colorScaleConfigDefaults, ChartTypeName, GrapherTabOption, StackMode,