PQB-113 +Trend Additions - #137
Open
prestoncraw wants to merge 5 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the Trend Data UI to support a new Statistics widget (tabular summary stats per selected channel/series), extends widget creation options in the navbar, and updates marker/overlay behavior—especially for histograms—so overlays render and interact correctly across supported plot types.
Changes:
- Adds a new
Statisticsplot type + widget (data fetch + derived summary statistics table with sorting). - Enables histogram overlays/markers and updates settings UI to hide irrelevant options for histogram plots.
- Refactors trend widget wrapping/registration so different plot types get the right widget, controls, and settings tabs.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| SEBrowser/Scripts/TSX/global.d.ts | Adds Statistics to the IPlotTypes union. |
| SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/TrendWidgetWrapper.tsx | Updates widget wrapper to support Statistics, improves histogram marker overlays/hover behavior, and adjusts controls. |
| SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/TrendWidgetRegistry.ts | Registers the Statistics widget and introduces a histogram-specific plot settings tab selection. |
| SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/Statistics/StatisticsData.ts | Implements statistics calculations + row-building logic. |
| SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/Statistics/Statistics.tsx | Implements the Statistics table widget with sorting and data-loading behavior. |
| SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/Histogram.tsx | Renders overlays for histograms and adjusts series-type handling. |
| SEBrowser/Scripts/TSX/Components/TrendData/TrendData.tsx | Switches TrendData to use the new widget wrapper component. |
| SEBrowser/Scripts/TSX/Components/TrendData/Settings/SettingsModal.tsx | Passes X-axis type into marker settings so histogram markers format correctly. |
| SEBrowser/Scripts/TSX/Components/TrendData/Settings/OverlayTabs/PlotSettingsTab.tsx | Adds flags to hide “Display Events” and “Axis Limits” options for certain plot types. |
| SEBrowser/Scripts/TSX/Components/TrendData/Settings/OverlayTabs/MarkerTab.tsx | Hides timestamp formatting when X-axis is a numeric value axis. |
| SEBrowser/Scripts/TSX/Components/TrendData/Settings/OverlayTabs/HistogramPlotSettingsTab.tsx | New wrapper tab that disables event + axis-limit UI for histograms. |
| SEBrowser/Scripts/TSX/Components/TrendData/NavBar/TrendDataNavbarButtons.tsx | Adds “Statistics” creation to existing grouping options and refactors add-plot logic. |
| SEBrowser/Scripts/TSX/Components/TrendData/Components/TrendMarkerTable.tsx | Uses X-axis type to format marker X-values appropriately and memoizes sorting. |
Suppressed comments (4)
SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/TrendWidgetWrapper.tsx:621
- This
keyduplicates thekey={"Marker_" + i}used for user-created symbolic markers later in the sameoverlaysarray, and it also uses an index key. Duplicate/unstable keys can cause React to reuse the wrong marker elements, which can break overlay rendering/interaction.
This issue also appears in the following locations of the same file:
- line 633
- line 663
- line 683
SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/TrendWidgetWrapper.tsx:637
- These marker overlays use index-based keys (and different prefixes) even though each marker has a stable
ID. Using indices as keys can cause marker components to get mismatched when markers are inserted/removed, which is especially risky for draggable markers.
SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/TrendWidgetWrapper.tsx:667 - User-created symbolic markers should use the stable marker
IDas the React key instead of an array index; otherwise React may reuse the wrong marker element after edits, impacting drag/move behavior.
SEBrowser/Scripts/TSX/Components/TrendData/TrendPlot/TrendWidgetWrapper.tsx:687 - The infobox
key/childId/innerdivid are derived from the array index. If markers are removed/reordered, these IDs can shift and cause the wrong infobox to be associated/moved. Use the marker’s stableIDinstead.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const binCount = 10; | ||
|
|
||
| const seriesTypes = ['Minimum', 'Average', 'Maximum'] as const; | ||
| const seriesTypes = ['Minimum', 'Average', 'Maximum']; |
Comment on lines
+86
to
+95
| props.SetChannelInfo((props.ChannelInfo ?? []).map(channel => { | ||
| const tag = getChannelTag(channel?.Channel?.ChannelID); | ||
| const channelPoints = tag == null ? [] : responsePoints.filter(point => typeof point?.Tag === 'string' && point.Tag.toLowerCase() === tag); | ||
| const settings = { ...(channel.Settings ?? {}) } as TrendSearch.ILineSeriesSettings; | ||
| statisticSeriesTypes.forEach(type => { | ||
| if (settings[type] != null) | ||
| settings[type] = { ...settings[type], HasData: channelPoints.some(point => Number.isFinite(point[type])) }; | ||
| }); | ||
| return { ...channel, Settings: settings }; | ||
| })); |
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.
Summary
This PR expands Trend Data visualization capabilities and fixes broken marker overlays.