Skip to content

Commit

Permalink
✨ (grapher) reflect "Show selection only" toggle in the URL (#3034)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann authored Dec 20, 2023
1 parent d0286bb commit 95b3b61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,12 @@ export class Grapher
} else if (params.uniformYAxis === "1") {
this.yAxis.facetDomain = FacetAxisDomain.shared
}

// only relevant for the table
if (params.showSelectionOnlyInTable) {
this.showSelectionOnlyInDataTable =
params.showSelectionOnlyInTable === "1" ? true : undefined
}
}

@action.bound private setTimeFromTimeQueryParam(time: string): void {
Expand Down Expand Up @@ -2649,6 +2655,8 @@ export class Grapher
this.maxTime = authorsVersion.maxTime
this.map.time = authorsVersion.map.time
this.map.projection = authorsVersion.map.projection
this.showSelectionOnlyInDataTable =
authorsVersion.showSelectionOnlyInDataTable
this.clearSelection()
}

Expand Down Expand Up @@ -2700,6 +2708,9 @@ export class Grapher
params.facet = this.selectedFacetStrategy
params.uniformYAxis =
this.yAxis.facetDomain === FacetAxisDomain.independent ? "0" : "1"
params.showSelectionOnlyInTable = this.showSelectionOnlyInDataTable
? "1"
: "0"
return setSelectedEntityNamesParam(
Url.fromQueryParams(params),
this.selectedEntitiesIfDifferentThanAuthors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export interface GrapherQueryParams extends QueryParams {
selection?: string
facet?: string
uniformYAxis?: string
showSelectionOnlyInTable?: string
}

export interface LegacyGrapherQueryParams extends GrapherQueryParams {
Expand Down

0 comments on commit 95b3b61

Please sign in to comment.