Skip to content

Commit

Permalink
web: fix hourly chart update
Browse files Browse the repository at this point in the history
  • Loading branch information
hoang-rio committed Nov 27, 2024
1 parent 4173683 commit 88c41c5
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 13 deletions.
11 changes: 7 additions & 4 deletions web_viewer/fe_src/src/components/HourlyChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ const HourlyChart = forwardRef(({ className }: IClassNameProps, ref: ForwardedRe

useImperativeHandle(ref, (): IUpdateChart => ({
updateItem(hourlyItem) {
console.log(hourlyItem)
const lastItem = chartData[chartData.length - 1];
if (JSON.stringify(lastItem) === JSON.stringify(hourlyItem)) {
return;
}
const newChartData = [...chartData];
if (lastItem[0] === hourlyItem[0]) {
chartData.splice(chartData.length -1, 1, hourlyItem);
newChartData.splice(chartData.length - 1, 1, hourlyItem);
} else {
chartData.push(hourlyItem);
newChartData.push(hourlyItem);
}
setChartData(chartData);
setChartData(newChartData);
},
}));

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
import{j as e}from"./index-pKDAJnNt.js";function l({value:r,unit:s,className:n}){return e.jsxs("div",{className:`${n||""} general-value`,children:[e.jsx("strong",{children:r}),s]})}export{l as G};
import{j as e}from"./index-B8XRob5j.js";function l({value:r,unit:s,className:n}){return e.jsxs("div",{className:`${n||""} general-value`,children:[e.jsx("strong",{children:r}),s]})}export{l as G};
1 change: 1 addition & 0 deletions web_viewer/public/assets/HourlyChart-BgAUfI3t.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion web_viewer/public/assets/HourlyChart-Bv9DEu29.js

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 88c41c5

Please sign in to comment.