From 90ca47347fd8d0b50fca55857786b4edf4479dab Mon Sep 17 00:00:00 2001 From: lsabor Date: Sat, 1 Nov 2025 13:16:28 -0700 Subject: [PATCH] include out of range values in discrete value options and display these extremees in table --- .../src/components/forecast_maker/continuous_table/index.tsx | 4 ++-- front_end/src/utils/charts/axis.ts | 4 ++-- front_end/src/utils/formatters/prediction.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/front_end/src/components/forecast_maker/continuous_table/index.tsx b/front_end/src/components/forecast_maker/continuous_table/index.tsx index 6c9dede0ad..65c9a7e7ca 100644 --- a/front_end/src/components/forecast_maker/continuous_table/index.tsx +++ b/front_end/src/components/forecast_maker/continuous_table/index.tsx @@ -189,7 +189,7 @@ const ContinuousTable: FC = ({ {question.open_lower_bound && ( - {getDisplayValue(0)} + {getDisplayValue(-0.1)} )} @@ -203,7 +203,7 @@ const ContinuousTable: FC = ({ {question.open_upper_bound && ( - {getDisplayValue(1)} + {getDisplayValue(1.1)} )} diff --git a/front_end/src/utils/charts/axis.ts b/front_end/src/utils/charts/axis.ts index d50f708eca..ffdf62516d 100644 --- a/front_end/src/utils/charts/axis.ts +++ b/front_end/src/utils/charts/axis.ts @@ -505,7 +505,7 @@ export function generateScale({ !isNil(rangeMax) ) { discreteValueOptions = []; - for (let i = 0; i < inbound_outcome_count; i++) { + for (let i = -1; i < inbound_outcome_count + 1; i++) { discreteValueOptions.push( rangeMin + ((rangeMax - rangeMin) * (i + 0.5)) / inbound_outcome_count ); @@ -522,7 +522,7 @@ export function generateScale({ ) { // get last label width to determine the number of labels const lastLabel = getPredictionDisplayValue( - 1 - 0.5 / inbound_outcome_count, + 1 + 0.5 / inbound_outcome_count, { questionType: displayType as QuestionType, scaling: rangeScaling, diff --git a/front_end/src/utils/formatters/prediction.ts b/front_end/src/utils/formatters/prediction.ts index 0fff5aafd8..6e27e3c10a 100644 --- a/front_end/src/utils/formatters/prediction.ts +++ b/front_end/src/utils/formatters/prediction.ts @@ -24,7 +24,7 @@ export function getDiscreteValueOptions( return undefined; } const discreteValueOptions: number[] = []; - for (let i = 0; i < question.inbound_outcome_count; i++) { + for (let i = -1; i < question.inbound_outcome_count + 1; i++) { discreteValueOptions.push( question.scaling.range_min + ((question.scaling.range_max - question.scaling.range_min) *