Skip to content

Commit

Permalink
🎉 enable line/slope chart switching in explorers
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Dec 11, 2024
1 parent bef2126 commit 4f1a062
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions adminSiteClient/EditorBasicTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/explorer/src/ExplorerProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 3 additions & 1 deletion packages/@ourworldindata/explorer/src/GrapherGrammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
ColorSchemeName,
FacetAxisDomain,
FacetStrategy,
GRAPHER_CHART_TYPES,
GRAPHER_TAB_OPTIONS,
MissingDataStrategy,
StackMode,
Expand Down Expand Up @@ -66,10 +67,11 @@ export const GrapherGrammar: Grammar<GrapherCellDef> = {
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: {
Expand Down

0 comments on commit 4f1a062

Please sign in to comment.