mirror of
https://github.com/home-assistant/frontend.git
synced 2026-09-28 16:04:00 +01:00
* Extract the history timeline chart data transform Move the body of state-history-chart-timeline's _generateData into state-history-chart-timeline-data.ts, mirroring the line chart's state-history-chart-line-data.ts. Environment inputs are passed in, so the transform is a pure function that can be tested and benchmarked on its own. No behaviour change. * Downsample the history timeline to the chart's pixel width The timeline emitted one rectangle per state change with no downsampling, so an entity with tens of thousands of recorded changes produced tens of thousands of rectangles and blocked the main thread for seconds inside ECharts' layout. Bound the output by the chart's device-pixel width, the way ha-chart-base already does for line series: segments at least one frame wide keep their exact bounds, and runs of narrower ones resolve per frame to the state covering most of that frame, merging with neighbours that resolve to the same state. Charts whose state changes are all wider than a frame, which is the common case, keep exactly the rectangles they had before. The host also becomes a block box so it reports its own width; as an inline box its clientWidth was always 0. * Narrow the timeline data transform's hass parameter to the states it reads * Pass entity states to the timeline data transform instead of hass