From f67c9f5d0d04561bbac3e1d83c67dc19ea8b5912 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Mon, 8 Sep 2025 18:56:21 -0700 Subject: [PATCH] feat(GraphComponent): Conditionally disable decimals for yAxis based on authored content --- .../graph/graph-student/graph-student.component.ts | 10 +++++++++- src/messages.xlf | 12 ++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/assets/wise5/components/graph/graph-student/graph-student.component.ts b/src/assets/wise5/components/graph/graph-student/graph-student.component.ts index eb99079aed2..64e07bd738c 100644 --- a/src/assets/wise5/components/graph/graph-student/graph-student.component.ts +++ b/src/assets/wise5/components/graph/graph-student/graph-student.component.ts @@ -602,7 +602,9 @@ export class GraphStudent extends ComponentStudent { */ drawGraphHelper(resolve) { this.turnOffXAxisDecimals(); - this.turnOffYAxisDecimals(); + if (!this.isAllowDecimalsForYAxis()) { + this.turnOffYAxisDecimals(); + } this.copyXAxisPlotBandsFromComponentContent(); this.setupXAxisLimitSpacerWidth(); let series = null; @@ -655,6 +657,12 @@ export class GraphStudent extends ComponentStudent { this.xAxis.allowDecimals = false; } + private isAllowDecimalsForYAxis(): boolean { + return isSingleYAxis(this.yAxis) + ? this.yAxis.allowDecimals + : this.yAxis.some((yAxis) => yAxis.allowDecimals); + } + turnOffYAxisDecimals() { if (isSingleYAxis(this.yAxis)) { this.yAxis.allowDecimals = false; diff --git a/src/messages.xlf b/src/messages.xlf index bbe61e76689..4551146444f 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -19189,39 +19189,39 @@ Category Name: The series you are trying to add a point to is currently hidden. Please show the series by clicking the series name in the legend and try adding the point again. src/assets/wise5/components/graph/graph-student/graph-student.component.ts - 853 + 861 You can not edit this series. Please choose a series that can be edited. src/assets/wise5/components/graph/graph-student/graph-student.component.ts - 867 + 875 Are you sure you want to reset the series? src/assets/wise5/components/graph/graph-student/graph-student.component.ts - 1100 + 1108 Are you sure you want to reset the "" series? src/assets/wise5/components/graph/graph-student/graph-student.component.ts - 1102 + 1110 Trial src/assets/wise5/components/graph/graph-student/graph-student.component.ts - 1519 + 1527 src/assets/wise5/components/graph/graph-student/graph-student.component.ts - 2351 + 2359