Skip to content

Commit

Permalink
fix(data-table): respect tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Oct 26, 2023
1 parent b528c1c commit 03f8280
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions packages/@ourworldindata/grapher/src/dataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,6 @@ export class DataTable extends React.Component<{
: TargetTimeMode.range

const prelimValuesByEntity = this.preliminaryDimensionValues(
targetTimeMode,
sourceColumn,
targetTimes
)
Expand Down Expand Up @@ -728,27 +727,14 @@ export class DataTable extends React.Component<{
}

private preliminaryDimensionValues(
targetTimeMode: TargetTimeMode,
sourceColumn: CoreColumn,
targetTimes: number[]
): Map<string, (DataValue | undefined)[]> {
return targetTimeMode === TargetTimeMode.range
? // In the "range" mode, we receive all data values within the range. But we

// only want to plot the start & end values in the table.
// getStartEndValues() extracts these two values.
es6mapValues(
valuesByEntityWithinTimes(
sourceColumn.valueByEntityNameAndOriginalTime,
targetTimes
),
getStartEndValues
)
: valuesByEntityAtTimes(
sourceColumn.valueByEntityNameAndOriginalTime,
targetTimes,
sourceColumn.tolerance
)
return valuesByEntityAtTimes(
sourceColumn.valueByEntityNameAndOriginalTime,
targetTimes,
sourceColumn.tolerance
)
}

private dataValuesFromPreliminaryValues(
Expand Down

0 comments on commit 03f8280

Please sign in to comment.