Description
Dashboard chart components contain heavy code duplication and hardcoded configurations, making it difficult to scale and support new sensors.
PowerCharts.jsx and TerosCharts.jsx duplicate most logic from UnifiedChart.jsx (data fetching, dataset creation, streaming, and state handling).
- Several legacy wrapper components (
PwrChart, VChart, TempChart, VwcChart) exist but are already replaced by UniversalChart.jsx.
- Sensor configurations are hardcoded inside
UnifiedChart.jsx.
Dashboard.jsx manually renders each chart instead of dynamically generating them.
Problems
- Code Duplication: Same chart logic exists in multiple files.
- Poor Scalability: Adding a new sensor requires editing multiple files.
- Unnecessary Components: Legacy chart wrappers increase maintenance complexity.
Proposed Changes
- Merge
PowerCharts.jsx and TerosCharts.jsx functionality into UnifiedChart.jsx.
- Remove legacy wrappers (
PwrChart, VChart, TempChart, VwcChart).
- Move
CHART_CONFIGS to a separate chartConfigs.js.
- Update
Dashboard.jsx to render charts dynamically using .map().
Acceptance Criteria
- Duplicate chart components are removed.
- Legacy wrapper components are deleted.
Dashboard.jsx renders charts dynamically from chartConfigs.js.
- Adding a new sensor only requires updating
chartConfigs.js.
- Existing dashboard functionality continues to work.
- All tests pass.
Description
Dashboard chart components contain heavy code duplication and hardcoded configurations, making it difficult to scale and support new sensors.
PowerCharts.jsxandTerosCharts.jsxduplicate most logic fromUnifiedChart.jsx(data fetching, dataset creation, streaming, and state handling).PwrChart,VChart,TempChart,VwcChart) exist but are already replaced byUniversalChart.jsx.UnifiedChart.jsx.Dashboard.jsxmanually renders each chart instead of dynamically generating them.Problems
Proposed Changes
PowerCharts.jsxandTerosCharts.jsxfunctionality intoUnifiedChart.jsx.PwrChart,VChart,TempChart,VwcChart).CHART_CONFIGSto a separatechartConfigs.js.Dashboard.jsxto render charts dynamically using.map().Acceptance Criteria
Dashboard.jsxrenders charts dynamically fromchartConfigs.js.chartConfigs.js.