From 67bc52b0e278368f98cea382219aa609665fc053 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Fri, 22 Nov 2024 16:58:22 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20enable=20line/slope=20chart=20sw?= =?UTF-8?q?itching=20in=20explorers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminSiteClient/EditorBasicTab.tsx | 4 ---- packages/@ourworldindata/explorer/src/ExplorerProgram.ts | 2 +- packages/@ourworldindata/explorer/src/GrapherGrammar.ts | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/adminSiteClient/EditorBasicTab.tsx b/adminSiteClient/EditorBasicTab.tsx index 1f48d420f64..e43ae527830 100644 --- a/adminSiteClient/EditorBasicTab.tsx +++ b/adminSiteClient/EditorBasicTab.tsx @@ -368,10 +368,6 @@ export class EditorBasicTab< ? [] : [value as GrapherChartType] - if (grapher.isLineChart) { - this.addSlopeChart() - } - if (grapher.isMarimekko) { grapher.hideRelativeToggle = false grapher.stackMode = StackMode.relative diff --git a/packages/@ourworldindata/explorer/src/ExplorerProgram.ts b/packages/@ourworldindata/explorer/src/ExplorerProgram.ts index 7d0f2a0ea24..c00007cc622 100644 --- a/packages/@ourworldindata/explorer/src/ExplorerProgram.ts +++ b/packages/@ourworldindata/explorer/src/ExplorerProgram.ts @@ -66,7 +66,7 @@ interface ExplorerGrapherInterface extends GrapherInterface { relatedQuestionText?: string relatedQuestionUrl?: string mapTargetTime?: number - type?: GrapherChartType | "None" + type?: GrapherChartType | "LineChart SlopeChart" | "None" } const ExplorerRootDef: CellDef = { diff --git a/packages/@ourworldindata/explorer/src/GrapherGrammar.ts b/packages/@ourworldindata/explorer/src/GrapherGrammar.ts index 78d6a82344a..9c12109ffd0 100644 --- a/packages/@ourworldindata/explorer/src/GrapherGrammar.ts +++ b/packages/@ourworldindata/explorer/src/GrapherGrammar.ts @@ -3,6 +3,7 @@ import { ColorSchemeName, FacetAxisDomain, FacetStrategy, + GRAPHER_CHART_TYPES, GRAPHER_TAB_OPTIONS, MissingDataStrategy, StackMode, @@ -66,10 +67,11 @@ export const GrapherGrammar: Grammar = { description: `The type of chart to show such as LineChart or ScatterPlot. If set to None, then the chart tab is hidden.`, terminalOptions: toTerminalOptions([ ...ALL_GRAPHER_CHART_TYPES, + `${GRAPHER_CHART_TYPES.LineChart} ${GRAPHER_CHART_TYPES.SlopeChart}`, "None", ]), toGrapherObject: (value) => ({ - chartTypes: value === "None" ? [] : [value], + chartTypes: value === "None" ? [] : value.split(" "), }), }, grapherId: {