Skip to content

Line chart trendline options for provided parameters to CalculateCurveFit API#7192

Merged
cnathe merged 14 commits intodevelopfrom
fb_trendlineProvidedParams
Nov 20, 2025
Merged

Line chart trendline options for provided parameters to CalculateCurveFit API#7192
cnathe merged 14 commits intodevelopfrom
fb_trendlineProvidedParams

Conversation

@cnathe
Copy link
Contributor

@cnathe cnathe commented Nov 10, 2025

Rationale

The current trendline implementation for Line Charts makes a call to the CalculateCurveFit API with some provided data points to calculate/generate a curve fit. In some cases, clients already have the calculated curve fit parameters (or we've already calculated it as part of an assay transform script). This update allows for the trendline configuration to set the field where the provided/saved parameters object exists and use that to pass values to the CalculateCurveFit API so they can be used instead of recalculating the curve fit each time the Line Chart is rendered.

In addition, we are implementing a new 5PL curve fit equation per client request.

Related Pull Requests

Changes

  • FiveParameterCurveFit implementation for new 5PL curve fit equation
  • Trendline config option for provided parameters variable and use it to get param object from seriesData
  • Trendline API call error messages to display above rendered SVG
  • Log scale to adjust values of zero to Number.EPSILON
  • StatsServiceImpl additions for FIVE_PARAMETER_ALT
  • Skip zero values with log scale and generated points

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for an alternate 5-parameter (5PL) curve fit model to the charting system. The new curve fit type implements Richard's five-parameter dose-response curve as an alternative to the existing 5PL implementation.

Key changes:

  • Adds new FIVE_PARAMETER_ALT curve fit type with corresponding "5 Parameter" label
  • Implements FiveParameterCurveFit class for the alternate 5PL equation
  • Adds support for passing curve fit parameters from data to the calculation API
  • Improves error handling and messaging for trendline calculation failures
  • Fixes zero-value handling for logarithmic scales to use Number.EPSILON instead of adding 1

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
visualization/resources/web/vis/genericChart/genericChartHelper.js Adds 5 Parameter trendline option, implements parameter passing from data, improves error handling, and fixes log scale zero-value handling
visualization/resources/web/vis/chartWizard/genericChartPanel.js Passes trendline parameters through chart configuration
core/src/org/labkey/core/statistics/ThreeParameterCurveFit.java Removes unused adjustedRSquared override method
core/src/org/labkey/core/statistics/StatsServiceImpl.java Adds FIVE_PARAMETER_ALT case, includes test expectations, and improves test assertion messages
core/src/org/labkey/core/statistics/ParameterCurveFit.java Adds FIVE_PARAMETER_ALT case to switch statements for adjusted R-squared and parameter calculation
core/src/org/labkey/core/statistics/FiveParameterCurveFit.java New implementation of alternate 5PL curve fit using Richard's equation
api/src/org/labkey/api/data/statistics/StatsService.java Adds FIVE_PARAMETER_ALT enum value with parameter names list for all curve fit types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cnathe cnathe self-assigned this Nov 10, 2025
Copy link
Contributor

@labkey-alan labkey-alan left a comment

Choose a reason for hiding this comment

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

Looks good to me, but I did not do any manual testing.

@cnathe cnathe merged commit d04bf18 into develop Nov 20, 2025
7 of 12 checks passed
@cnathe cnathe deleted the fb_trendlineProvidedParams branch November 20, 2025 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants