Skip to content

Commit

Permalink
Merge pull request #2837 from owid/hotfix-remove-missing-data-strateg…
Browse files Browse the repository at this point in the history
…y-for-discrete-bar-charts

hotfix(grapher): remove missing data strategy for (stacked) discrete bar charts
  • Loading branch information
sophiamersmann authored Oct 24, 2023
2 parents 48214ce + a5c7d58 commit 90b6cef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 35 deletions.
10 changes: 3 additions & 7 deletions adminSiteClient/EditorFeatures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
BASE_FONT_SIZE,
SeriesStrategy,
FacetStrategy,
MissingDataStrategy,
} from "../core/GrapherConstants"
import {
HorizontalAxisComponent,
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { observer } from "mobx-react"
import {
BASE_FONT_SIZE,
FacetStrategy,
MissingDataStrategy,
SeriesName,
} from "../core/GrapherConstants"
import {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 90b6cef

Please sign in to comment.