Line chart trendline options for provided parameters to CalculateCurveFit API#1888
Merged
Line chart trendline options for provided parameters to CalculateCurveFit API#1888
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for providing parameters to trendline calculations in the chart builder by introducing a new "Provided Parameters" field in trendline options and adding support for the new "5 Parameter" nonlinear curve fit option.
Key changes:
- Refactored
getSelectOptionsutility function from ChartFieldOption.tsx to utils.ts for reusability - Added new "Provided Parameters" field in TrendlineOption component with gear icon popover
- Extended ChartBuilderModal to handle trendlineParameters in chart configuration
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/components/src/internal/components/chart/utils.ts | Moved getSelectOptions function here for reusability; added imports for QueryModel, SelectInputOption, and sorting utilities |
| packages/components/src/internal/components/chart/utils.test.ts | Added tests for getSelectOptions function with mock LABKEY_VIS setup |
| packages/components/src/internal/components/chart/TrendlineOption.tsx | Added "Provided Parameters" SelectInput field with useMemo hooks for options and value handling; reorganized popover content |
| packages/components/src/internal/components/chart/TrendlineOption.test.tsx | Updated all tests to include new required props (model, selectedType) and added mock data setup |
| packages/components/src/internal/components/chart/CurveFitStatsGrid.tsx | Added '5 Parameter' to NonlinearCurveFit type and nonLinearTrendlineTypes array |
| packages/components/src/internal/components/chart/ChartFieldOption.tsx | Removed getSelectOptions function and unused import; imported function from utils instead |
| packages/components/src/internal/components/chart/ChartFieldOption.test.tsx | Removed tests for getSelectOptions (moved to utils.test.ts); added missing mock props to existing tests |
| packages/components/src/internal/components/chart/ChartBuilderModal.tsx | Added filtering for equation fields in query config; added trendlineParameters to chart config initialization and handling |
| packages/components/releaseNotes/components.md | Added release notes for new trendline features |
| packages/components/package.json | Updated version to pre-release version with feature branch suffix |
| packages/components/package-lock.json | Updated version in lockfile to match package.json |
Files not reviewed (1)
- packages/components/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/components/src/internal/components/chart/TrendlineOption.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/internal/components/chart/ChartBuilderModal.tsx
Outdated
Show resolved
Hide resolved
labkey-alan
approved these changes
Nov 11, 2025
Contributor
labkey-alan
left a comment
There was a problem hiding this comment.
Overall it looks good. I did leave some very minor feedback. I did not manual test these changes because it looks like Karl was tagged for that, let me know if that changes.
packages/components/src/internal/components/chart/TrendlineOption.tsx
Outdated
Show resolved
Hide resolved
packages/components/src/internal/components/chart/TrendlineOption.tsx
Outdated
Show resolved
Hide resolved
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.
Related Pull Requests
Changes