|
1 | 1 | import { useRef, useEffect, useCallback } from 'react'; |
2 | 2 | import uPlot from 'uplot'; |
3 | 3 | import 'uplot/dist/uPlot.min.css'; |
4 | | -import { stateTimelinePlugin, calculateStateTimelineHeight, type StateRow } from './stateTimelinePlugin'; |
| 4 | +import { |
| 5 | + stateTimelinePlugin, |
| 6 | + calculateStateTimelineHeight, |
| 7 | + type StateRow, |
| 8 | +} from './stateTimelinePlugin'; |
5 | 9 | import './LineChart.css'; |
6 | 10 |
|
7 | 11 | // Channel colors (16 max) |
@@ -38,7 +42,12 @@ interface LineChartProps { |
38 | 42 | // Re-export StateRow type for use by PlotterWindow |
39 | 43 | export type { StateRow }; |
40 | 44 |
|
41 | | -export default function LineChart({ data, isPaused = false, stateRows = [], onTimeRangeChange }: LineChartProps) { |
| 45 | +export default function LineChart({ |
| 46 | + data, |
| 47 | + isPaused = false, |
| 48 | + stateRows = [], |
| 49 | + onTimeRangeChange, |
| 50 | +}: LineChartProps) { |
42 | 51 | const containerRef = useRef<HTMLDivElement>(null); |
43 | 52 | const chartRef = useRef<uPlot | null>(null); |
44 | 53 | const channelsRef = useRef<string[]>([]); |
@@ -265,14 +274,17 @@ export default function LineChart({ data, isPaused = false, stateRows = [], onTi |
265 | 274 | }, |
266 | 275 | ], |
267 | 276 | }, |
268 | | - plugins: stateRows.length > 0 ? [ |
269 | | - stateTimelinePlugin({ |
270 | | - getRows: () => stateRowsRef.current, |
271 | | - rowHeight: 24, |
272 | | - rowGap: 2, |
273 | | - showLabel: true, |
274 | | - }), |
275 | | - ] : [], |
| 277 | + plugins: |
| 278 | + stateRows.length > 0 |
| 279 | + ? [ |
| 280 | + stateTimelinePlugin({ |
| 281 | + getRows: () => stateRowsRef.current, |
| 282 | + rowHeight: 24, |
| 283 | + rowGap: 2, |
| 284 | + showLabel: true, |
| 285 | + }), |
| 286 | + ] |
| 287 | + : [], |
276 | 288 | }; |
277 | 289 |
|
278 | 290 | // Update stateRowsRef before chart creation (plugin uses this reference) |
|
0 commit comments