Skip to content

PQB-113 +Trend Additions - #137

Open
prestoncraw wants to merge 5 commits into
developmentfrom
PQB-113-StatsTable
Open

PQB-113 +Trend Additions#137
prestoncraw wants to merge 5 commits into
developmentfrom
PQB-113-StatsTable

Conversation

@prestoncraw

@prestoncraw prestoncraw commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR expands Trend Data visualization capabilities and fixes broken marker overlays.

  • Fixes marker overlay rendering and interaction for trend plots.
  • Adds a sortable Statistics table widget with minimum, average, maximum, cumulative probability values, count, and standard deviation.
  • Supports creating Line, Histogram, and Statistics widgets from each grouping option.
  • Adds horizontal, vertical, and symbolic markers to Histogram widgets, including histogram-aware value formatting and dual-axis hover values.
  • Updates histogram settings to expose only relevant configuration options.

Copilot AI left a comment

Copy link
Copy Markdown

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 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 Statistics plot 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 key duplicates the key={"Marker_" + i} used for user-created symbolic markers later in the same overlays array, 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 ID as 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/inner div id 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 stable ID instead.

💡 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 };
}));
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