Skip to content

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

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

Line chart trendline options for provided parameters to CalculateCurveFit API#1888
cnathe merged 20 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.

Related Pull Requests

Changes

  • ChartBuilderModal update to include trendline option for provided parameters
  • Include new 5 Parameter nonlinear curve fit option in trendline select

Copy link

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 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 getSelectOptions utility 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.

@cnathe cnathe requested a review from labkey-alan November 10, 2025 15:13
@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.

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.

@cnathe cnathe merged commit 8951a44 into develop Nov 20, 2025
3 checks passed
@cnathe cnathe deleted the fb_trendlineProvidedParams branch November 20, 2025 20:52
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.

2 participants