diff --git a/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx b/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx index 778b8318749..af4c26003d3 100644 --- a/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx +++ b/packages/@ourworldindata/grapher/src/captionedChart/CaptionedChart.tsx @@ -228,27 +228,24 @@ export class CaptionedChart extends React.Component { } private renderControlsRow(): JSX.Element { - const showControls = !this.manager.isOnTableTab return ( ) } diff --git a/packages/@ourworldindata/grapher/src/controls/Controls.tsx b/packages/@ourworldindata/grapher/src/controls/Controls.tsx index 8eb6784922f..c9055419987 100644 --- a/packages/@ourworldindata/grapher/src/controls/Controls.tsx +++ b/packages/@ourworldindata/grapher/src/controls/Controls.tsx @@ -143,6 +143,10 @@ export interface SettingsMenuManager { // show intermediate scatterplot points compareEndPointsOnly?: boolean + + // use entity selection from chart to filter table rows + isOnTableTab?: boolean + showSelectionOnlyInDataTable?: boolean } @observer @@ -220,6 +224,7 @@ export class SettingsMenu extends React.Component<{ filledDimensions, availableFacetStrategies, hideFacetControl, + isOnTableTab, type, } = this.manager @@ -241,11 +246,17 @@ export class SettingsMenu extends React.Component<{ (dim) => dim.display.isProjection ) - return showFacetControlChartType && !hideFacetControl && !hasProjection + return ( + showFacetControlChartType && + !hideFacetControl && + !hasProjection && + !isOnTableTab + ) } @computed get showSettingsMenuToggle(): boolean { if (this.manager.isOnMapTab) return false + if (this.manager.isOnTableTab) return true return !!( this.showYScaleToggle || @@ -321,7 +332,14 @@ export class SettingsMenu extends React.Component<{ showAbsRelToggle, } = this - const { yAxis, xAxis, compareEndPointsOnly, filledDimensions } = manager + const { + yAxis, + xAxis, + compareEndPointsOnly, + filledDimensions, + isOnTableTab, + } = manager + const yLabel = filledDimensions.find((d: ChartDimension) => d.property === "y") ?.display.name ?? "Y axis", @@ -331,6 +349,8 @@ export class SettingsMenu extends React.Component<{ omitLoneAxisLabel = showYScaleToggle && !showXScaleToggle && yLabel === "Y axis" + const menuTitle = `${isOnTableTab ? "Table" : chartType} settings` + return (
-
{chartType} settings
+
{menuTitle}