Skip to content

Refactor Dashboard Chart Components #669

@Saurabhsing21

Description

@Saurabhsing21

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

  1. Merge PowerCharts.jsx and TerosCharts.jsx functionality into UnifiedChart.jsx.
  2. Remove legacy wrappers (PwrChart, VChart, TempChart, VwcChart).
  3. Move CHART_CONFIGS to a separate chartConfigs.js.
  4. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions