Skip to content

Commit d490c6c

Browse files
committed
update points on charts
1 parent 110106c commit d490c6c

2 files changed

Lines changed: 6 additions & 11 deletions

File tree

ethernet-view/src/pages/LoggerPage/ChartsColumn/ChartMenu/ChartElement/ChartCanvas.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,25 @@ export const ChartCanvas = ({ measurementsInChart, getDataFromLogSession }: Prop
3636
width: chartContainerRef.current.clientWidth,
3737
height: CHART_HEIGHT,
3838
timeScale: {
39+
timeVisible: true,
3940
fixLeftEdge: true,
4041
fixRightEdge: true,
4142
lockVisibleTimeRangeOnResize: true,
4243
},
4344
});
4445
}
4546

46-
let chartTime = timeRendered.current;
4747
for(const measurement of measurementsInChart) {
4848
const data = getDataFromLogSession(measurement.id);
4949
const series = chart.current?.addLineSeries({
5050
color: measurement.color,
5151
})
52+
console.log(data)
5253
for(const point of data) {
53-
series?.update({ time: chartTime++ as UTCTimestamp, value: point.value });
54+
series?.update({ time: point.time / 1000 as UTCTimestamp, value: point.value });
5455
}
55-
chartTime = timeRendered.current;
5656
}
57-
58-
chart.current?.timeScale().setVisibleRange({
59-
from: timeRendered.current as UTCTimestamp,
60-
to: timeRendered.current + 60 as UTCTimestamp,
61-
})
62-
57+
6358
return () => {
6459
resizeObserver.disconnect();
6560
chart.current?.remove();

ethernet-view/src/pages/LoggerPage/LogsColumn/LogLoader/LogsProcessor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Papa from 'papaparse';
1616
* retrieved from the CSV file.
1717
*/
1818

19-
export type ChartPoint = {time: UTCTimestamp, value: number};
19+
export type ChartPoint = {time: number, value: number};
2020
export type Session = Map<string, ChartPoint[]>;
2121

2222
export async function extractLoggerSession (directory: FileSystemDirectoryEntry): Promise<Session> {
@@ -36,7 +36,7 @@ export async function extractLoggerSession (directory: FileSystemDirectoryEntry)
3636
if(isValidLog(row)) {
3737
const [timestamp, , , value] = row as [string, string, string, string];
3838
measurementPoints.push({
39-
time: parseFloat(timestamp) / 1000 as UTCTimestamp,
39+
time: parseFloat(timestamp),
4040
value: parseFloat(value)
4141
});
4242
}

0 commit comments

Comments
 (0)