From a5c7d58a68f1776a16c7ee65c30c6eaf3e2392a6 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Tue, 24 Oct 2023 11:21:14 +0000 Subject: [PATCH] hotfix(grapher): remove missing data strategy for (stacked) discrete bar charts --- adminSiteClient/EditorFeatures.tsx | 10 +++------- .../grapher/src/barCharts/DiscreteBarChart.tsx | 14 -------------- .../src/stackedCharts/StackedDiscreteBarChart.tsx | 14 -------------- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/adminSiteClient/EditorFeatures.tsx b/adminSiteClient/EditorFeatures.tsx index fd8ea4cde63..2cc72c43a45 100644 --- a/adminSiteClient/EditorFeatures.tsx +++ b/adminSiteClient/EditorFeatures.tsx @@ -108,13 +108,9 @@ export class EditorFeatures { return true } - // for line charts and discrete bar charts, specifying a missing - // data strategy only makes sense if there are multiple entities - if ( - this.grapher.isLineChart || - this.grapher.isDiscreteBar || - this.grapher.isStackedDiscreteBar - ) { + // for line charts, specifying a missing data strategy only makes sense + // if there are multiple entities + if (this.grapher.isLineChart) { return ( this.grapher.canChangeEntity || this.grapher.canSelectMultipleEntities diff --git a/packages/@ourworldindata/grapher/src/barCharts/DiscreteBarChart.tsx b/packages/@ourworldindata/grapher/src/barCharts/DiscreteBarChart.tsx index 60bac377190..f89d9d7568a 100644 --- a/packages/@ourworldindata/grapher/src/barCharts/DiscreteBarChart.tsx +++ b/packages/@ourworldindata/grapher/src/barCharts/DiscreteBarChart.tsx @@ -25,7 +25,6 @@ import { BASE_FONT_SIZE, SeriesStrategy, FacetStrategy, - MissingDataStrategy, } from "../core/GrapherConstants" import { HorizontalAxisComponent, @@ -126,15 +125,6 @@ export class DiscreteBarChart .interpolateColumnWithTolerance(this.colorColumnSlug) } - // drop all data when the author chose to hide entities with missing data and - // at least one of the variables has no data for the current entity - if ( - this.missingDataStrategy === MissingDataStrategy.hide && - table.hasAnyColumnNoValidValue(this.yColumnSlugs) - ) { - table = table.dropAllRows() - } - return table } @@ -153,10 +143,6 @@ export class DiscreteBarChart return this.props.manager } - @computed private get missingDataStrategy(): MissingDataStrategy { - return this.manager.missingDataStrategy || MissingDataStrategy.auto - } - @computed private get targetTime(): Time | undefined { return this.manager.endTime } diff --git a/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx b/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx index 7c67cbe804e..341b6b8c61c 100644 --- a/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx +++ b/packages/@ourworldindata/grapher/src/stackedCharts/StackedDiscreteBarChart.tsx @@ -24,7 +24,6 @@ import { observer } from "mobx-react" import { BASE_FONT_SIZE, FacetStrategy, - MissingDataStrategy, SeriesName, } from "../core/GrapherConstants" import { @@ -130,15 +129,6 @@ export class StackedDiscreteBarChart ) } - // drop all data when the author chose to hide entities with missing data and - // at least one of the variables has no data for the current entity - if ( - this.missingDataStrategy === MissingDataStrategy.hide && - table.hasAnyColumnNoValidValue(this.yColumnSlugs) - ) { - table = table.dropAllRows() - } - return table } @@ -168,10 +158,6 @@ export class StackedDiscreteBarChart return (this.props.bounds ?? DEFAULT_BOUNDS).padRight(10).padBottom(2) } - @computed private get missingDataStrategy(): MissingDataStrategy { - return this.manager.missingDataStrategy || MissingDataStrategy.auto - } - @computed private get baseFontSize(): number { return this.manager.baseFontSize ?? BASE_FONT_SIZE }