Skip to content

Commit

Permalink
enhance(StackedBar): disable uniform spacing for charts with daily data
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Apr 12, 2023
1 parent 51ba782 commit 848df7a
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { ColorSchemeName } from "../color/ColorConstants"
import { stackSeries, withMissingValuesAsZeroes } from "./StackedUtils"
import { makeClipPath } from "../chart/ChartUtils"
import { ColorScaleConfigDefaults } from "../color/ColorScaleConfig"
import { ColumnTypeMap } from "@ourworldindata/core-table"

interface StackedBarSegmentProps extends React.SVGAttributes<SVGGElement> {
bar: StackedPoint<Time>
Expand Down Expand Up @@ -587,9 +588,14 @@ export class StackedBarChart
defaultBaseColorScheme = ColorSchemeName.stackedAreaDefault

@computed get series(): readonly StackedSeries<number>[] {
// TODO: remove once monthly data is supported (https://github.com/owid/owid-grapher/issues/2007)
const enforceUniformSpacing = !(
this.transformedTable.timeColumn instanceof ColumnTypeMap.Day
)

return stackSeries(
withMissingValuesAsZeroes(this.unstackedSeries, {
enforceUniformSpacing: true,
enforceUniformSpacing,
})
)
}
Expand Down

0 comments on commit 848df7a

Please sign in to comment.