From 0450dff98f1ab5de42d35c1bbe030fe7540793ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Uribe=20Stengel?= Date: Tue, 14 Jul 2020 18:28:13 +0200 Subject: [PATCH] Separate Chart into four different ones. --- imports/ui/Home.jsx | 71 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 16 deletions(-) diff --git a/imports/ui/Home.jsx b/imports/ui/Home.jsx index 94709d2..e2715cc 100644 --- a/imports/ui/Home.jsx +++ b/imports/ui/Home.jsx @@ -1,32 +1,71 @@ -import React, {useEffect, useState} from 'react' // useState to rerender the view each time something changed +import React from 'react' import {CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts'; import SensorCardDeck from './SensorCardDeck' import {SensorDataCollection} from "../../client/main"; import {useTracker} from 'meteor/react-meteor-data'; +import {Col, Row} from "react-bootstrap"; export default function Home() { const sensorData = useTracker(() => { - return SensorDataCollection.find({ device_id: 'esp-andy' }, { sort: { timestamp: -1 }, limit: 10 }).fetch(); + return SensorDataCollection.find({ device_id: 'esp-andy' }, { sort: { timestamp: -1 }, limit: 10 }).fetch().reverse(); }); return ( <> - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) } \ No newline at end of file