Skip to content

Commit

Permalink
🐛 (marimekko) drop entities without data
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Apr 5, 2024
1 parent c5988d1 commit 1d955ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 5 additions & 6 deletions packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ export class Grapher
// different; e.g. for scatterplots, the entity needs to (1) not be excluded and
// (2) needs to have data for the x and y dimension.
let table =
this.isScatter || this.isSlopeChart
this.isScatter || this.isMarimekko || this.isSlopeChart
? this.tableAfterAuthorTimelineAndActiveChartTransform
: this.inputTable

Expand Down Expand Up @@ -780,15 +780,14 @@ export class Grapher
table.get(this.mapColumnSlug).tolerance
)

if (
this.isDiscreteBar ||
this.isLineChartThatTurnedIntoDiscreteBar ||
this.isMarimekko
)
if (this.isDiscreteBar || this.isLineChartThatTurnedIntoDiscreteBar) {
return table.filterByTargetTimes(
[endTime],
table.get(this.yColumnSlugs[0]).tolerance
)
}

if (this.isMarimekko) return table.filterByTargetTimes([endTime])

if (this.isSlopeChart)
return table.filterByTargetTimes([startTime, endTime])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,14 @@ export class MarimekkoChart
table = table.dropRowsWithErrorValuesForColumn(colorColumnSlug)
}
}
if (!manager.showNoDataArea)

const hideNoDataArea = !manager.showNoDataArea || !xColumnSlug
if (hideNoDataArea)
table = table.dropRowsWithErrorValuesForAllColumns(yColumnSlugs)

if (xColumnSlug)
table = table.dropRowsWithErrorValuesForColumn(xColumnSlug)

if (manager.isRelativeMode) {
// TODO: this should not be necessary but we sometimes get NoMatchingValuesAfterJoin if both relative and showNoDataArea are set
table = table.dropRowsWithErrorValuesForColumn(
Expand Down

0 comments on commit 1d955ae

Please sign in to comment.