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 6, 2024
1 parent 37de4b0 commit e516ac6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/@ourworldindata/explorer/src/ExplorerProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
GrapherInterface,
AxisMinMaxValueStr,
GrapherChartType,
GRAPHER_CHART_TYPES,

Check warning on line 12 in packages/@ourworldindata/explorer/src/ExplorerProgram.ts

View workflow job for this annotation

GitHub Actions / eslint

'GRAPHER_CHART_TYPES' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 12 in packages/@ourworldindata/explorer/src/ExplorerProgram.ts

View workflow job for this annotation

GitHub Actions / eslint

'GRAPHER_CHART_TYPES' is defined but never used. Allowed unused vars must match /^_/u
} from "@ourworldindata/types"
import {
CoreTable,
Expand Down Expand Up @@ -66,7 +67,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 e516ac6

Please sign in to comment.