Skip to content

Commit

Permalink
✨ use 'nice' axis ticks for linear scales
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Jan 9, 2025
1 parent ea5361d commit 1e14c4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1410,9 +1410,9 @@ export class LineChart
}

@computed private get yAxisConfig(): AxisConfig {
// TODO: enable nice axis ticks for linear scales
return new AxisConfig(
{
nice: this.manager.yAxisConfig?.scaleType !== ScaleType.log,
// if we only have a single y value (probably 0), we want the
// horizontal axis to be at the bottom of the chart.
// see https://github.com/owid/owid-grapher/pull/975#issuecomment-890798547
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,13 @@ export class AbstractStackedChart
}

@computed private get yAxisConfig(): AxisConfig {
// TODO: enable nice axis ticks for linear scales
return new AxisConfig(this.manager.yAxisConfig, this)
return new AxisConfig(
{
nice: true,
...this.manager.yAxisConfig,
},
this
)
}

// implemented in subclasses
Expand Down

0 comments on commit 1e14c4c

Please sign in to comment.