Skip to content

Conversation

perryr16
Copy link
Contributor

@perryr16 perryr16 commented Oct 6, 2025

Any background context you want to provide?

Default report scales could get out of sync when changing between reports. Zooming in or out would set the default scales for any future report.

What's this PR do?

Resets the x & y max scale values on report change

How should this be manually tested?

Repeat the below procedure for both scatter and bar charts.

  • Create 2 reports
  • Load report 1
  • Zoom in or out
  • Change to report 2
  • The report x & y scale min/max should appear meaningful (the reset zoom should always bring all data back into view).

What are the relevant tickets?

#5109

Screenshots (if appropriate)

@perryr16 perryr16 added the Bug label Oct 6, 2025
Comment on lines 630 to 641
yAxisMin: $scope.yAxisSelectedItem.axisMin,
yAxisMax: $scope.yAxisSelectedItem.axisMax,
xAxisTickFormat: $scope.xAxisSelectedItem.axisTickFormat,
yAxisTickFormat: $scope.yAxisSelectedItem.axisTickFormat
};

// new chartJS chart data
// yAxisVars.axisMin and axisMax are unused and will remain 'undefined'.
// They may be placeholders for future functionality.
// Leaving them undefined is ideal, as it lets Chart.js automatically determine the proper min/max values.
$scope.scatterChart.options.scales.y.min = $scope.yAxisSelectedItem.axisMin;
$scope.scatterChart.options.scales.y.max = $scope.yAxisSelectedItem.axisMax;
$scope.scatterChart.options.scales.y.type = $scope.chartData.chartData.every((d) => typeof d.y === 'number') ? 'linear' : 'category';
Copy link
Contributor Author

@perryr16 perryr16 Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't found any code that would set .axisMin or .axisMax. But I'm leaving it in, in case I've missed something, or it's the base for future functionality. It shouldnt matter because resetting the scales to undefined fixes the issue.

@perryr16 perryr16 requested a review from kflemin October 7, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant