Skip to content

Commit

Permalink
chore: show 2 years in charts
Browse files Browse the repository at this point in the history
  • Loading branch information
mdvanes committed May 9, 2024
1 parent 589eacd commit 079688f
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions apps/client/src/Components/Pages/Energy/charts/ElectricChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const ElectricChart: FC<{
// TODO add averaging
const entries: { time: number }[] | undefined = year1[0].entries?.map(
(entry, index) => {
const [h, m] = entry.time?.split(":") ?? ["0", "0"];
const time = year1Item1Date;
time.setHours(parseInt(h));
time.setMinutes(parseInt(m));
const formatTime = entry.time?.replace(" ", "T") + ":00.000+02:00";
const newDate = new Date(formatTime ?? "");

return {
time: time.getTime(),
time: newDate.getTime(),
[year1Item1Year]: entry.v,
[year2Item1Year]: year2[index],
// TODO assumes that timestamps matches indexes
[year2Item1Year]: year2[0]?.entries?.[index]?.v ?? 0,
};
}
);
Expand All @@ -44,7 +44,7 @@ export const ElectricChart: FC<{
{
dataKey: year1Item1Year,
stroke: COLORS[0],
unit: "kWh",
// unit: "kWh",
},
{
dataKey: year2Item1Year,
Expand All @@ -63,12 +63,12 @@ export const ElectricChart: FC<{
// unit: "°C",
// },
],
leftYAxis: {
unit: "%",
},
rightYAxis: {
unit: "°",
},
// leftYAxis: {
// unit: "%",
// },
// rightYAxis: {
// unit: "°",
// },
}}
isLoading={false}
// isLoading={isLoading || isFetching}
Expand Down

0 comments on commit 079688f

Please sign in to comment.