From 20c480788620cf3b6c633b43195b15fd04897e8e Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Thu, 24 Oct 2024 10:39:16 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20(line=20chart)=20set=20y-axis=20min?= =?UTF-8?q?=20default=20to=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/@ourworldindata/grapher/src/axis/AxisConfig.ts | 1 - .../@ourworldindata/grapher/src/lineCharts/LineChart.tsx | 2 ++ .../grapher/src/schema/defaultGrapherConfig.ts | 2 -- .../grapher/src/schema/grapher-schema.005.yaml | 5 +++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/@ourworldindata/grapher/src/axis/AxisConfig.ts b/packages/@ourworldindata/grapher/src/axis/AxisConfig.ts index 2226665d24c..f9b8442a86d 100644 --- a/packages/@ourworldindata/grapher/src/axis/AxisConfig.ts +++ b/packages/@ourworldindata/grapher/src/axis/AxisConfig.ts @@ -96,7 +96,6 @@ export class AxisConfig deleteRuntimeAndUnchangedProps(obj, new AxisConfigDefaults()) - if (obj.min === undefined) obj.min = AxisMinMaxValueStr.auto if (obj.max === undefined) obj.max = AxisMinMaxValueStr.auto return obj diff --git a/packages/@ourworldindata/grapher/src/lineCharts/LineChart.tsx b/packages/@ourworldindata/grapher/src/lineCharts/LineChart.tsx index 6b6e2b64ce4..9d7ef0b593d 100644 --- a/packages/@ourworldindata/grapher/src/lineCharts/LineChart.tsx +++ b/packages/@ourworldindata/grapher/src/lineCharts/LineChart.tsx @@ -1342,6 +1342,8 @@ export class LineChart // horizontal axis to be at the bottom of the chart. // see https://github.com/owid/owid-grapher/pull/975#issuecomment-890798547 singleValueAxisPointAlign: AxisAlign.start, + // default to a minimum value of 0 if not set + min: 0, ...this.manager.yAxisConfig, }, this diff --git a/packages/@ourworldindata/grapher/src/schema/defaultGrapherConfig.ts b/packages/@ourworldindata/grapher/src/schema/defaultGrapherConfig.ts index 6497d08f13c..dd0f68334e2 100644 --- a/packages/@ourworldindata/grapher/src/schema/defaultGrapherConfig.ts +++ b/packages/@ourworldindata/grapher/src/schema/defaultGrapherConfig.ts @@ -26,7 +26,6 @@ export const defaultGrapherConfig = { maxTime: "latest", yAxis: { removePointsOutsideDomain: false, - min: "auto", scaleType: "linear", max: "auto", canChangeScaleType: false, @@ -66,7 +65,6 @@ export const defaultGrapherConfig = { }, xAxis: { removePointsOutsideDomain: false, - min: "auto", scaleType: "linear", max: "auto", canChangeScaleType: false, diff --git a/packages/@ourworldindata/grapher/src/schema/grapher-schema.005.yaml b/packages/@ourworldindata/grapher/src/schema/grapher-schema.005.yaml index 79ca82b4122..4465a68f6c0 100644 --- a/packages/@ourworldindata/grapher/src/schema/grapher-schema.005.yaml +++ b/packages/@ourworldindata/grapher/src/schema/grapher-schema.005.yaml @@ -514,8 +514,9 @@ $defs: type: string description: Axis label min: - description: Minimum domain value of the axis. Inferred from data if set to "auto". - default: auto + description: | + Minimum domain value of the axis. Inferred from data if set to "auto". + Usually defaults to "auto", but defaults to 0 for line charts on the y-axis. oneOf: - type: number - type: string