Line chart trendline options for provided parameters to CalculateCurveFit API#7192
Merged
Line chart trendline options for provided parameters to CalculateCurveFit API#7192
Conversation
…o get param object from seriesData
Contributor
There was a problem hiding this comment.
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_ALTcurve fit type with corresponding "5 Parameter" label - Implements
FiveParameterCurveFitclass 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.EPSILONinstead 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.
visualization/resources/web/vis/genericChart/genericChartHelper.js
Outdated
Show resolved
Hide resolved
visualization/resources/web/vis/genericChart/genericChartHelper.js
Outdated
Show resolved
Hide resolved
labkey-klum
approved these changes
Nov 10, 2025
labkey-alan
approved these changes
Nov 11, 2025
Contributor
labkey-alan
left a comment
There was a problem hiding this comment.
Looks good to me, but I did not do any manual testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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