diff --git a/tests/simulation/data/batteries.json b/tests/simulation/data/batteries.json index 828acd4..288a9b8 100644 --- a/tests/simulation/data/batteries.json +++ b/tests/simulation/data/batteries.json @@ -1,434 +1,434 @@ [ - { - "batteries": [ - { - "voltage": 8, - "current": 5 - }, - { - "voltage": 8, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 5 - }, - { - "voltage": 10, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 3 - }, - { - "voltage": 9, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 3 - }, - { - "voltage": 5, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 8, - "current": 5 - }, - { - "voltage": 5, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 4 - }, - { - "voltage": 10, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 4 - }, - { - "voltage": 5, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 5 - }, - { - "voltage": 5, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 5 - }, - { - "voltage": 5, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 4 - }, - { - "voltage": 7, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 4 - }, - { - "voltage": 6, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 5 - }, - { - "voltage": 8, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 4 - }, - { - "voltage": 10, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 5, - "current": 5 - }, - { - "voltage": 5, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 4 - }, - { - "voltage": 7, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 3 - }, - { - "voltage": 6, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 7, - "current": 4 - }, - { - "voltage": 6, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 7, - "current": 5 - }, - { - "voltage": 7, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 5 - }, - { - "voltage": 6, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 4 - }, - { - "voltage": 10, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 4 - }, - { - "voltage": 8, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 5 - }, - { - "voltage": 7, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 4 - }, - { - "voltage": 9, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 3 - }, - { - "voltage": 7, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 4 - }, - { - "voltage": 5, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 7, - "current": 3 - }, - { - "voltage": 10, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 4 - }, - { - "voltage": 7, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 7, - "current": 3 - }, - { - "voltage": 7, - "current": 4 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 4 - }, - { - "voltage": 7, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 6, - "current": 3 - }, - { - "voltage": 7, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 10, - "current": 3 - }, - { - "voltage": 5, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 4 - }, - { - "voltage": 7, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 8, - "current": 5 - }, - { - "voltage": 9, - "current": 3 - } - ] - }, - { - "batteries": [ - { - "voltage": 9, - "current": 4 - }, - { - "voltage": 5, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 5, - "current": 5 - }, - { - "voltage": 5, - "current": 5 - } - ] - }, - { - "batteries": [ - { - "voltage": 7, - "current": 3 - }, - { - "voltage": 6, - "current": 4 - } - ] - } -] \ No newline at end of file + { + "batteries": [ + { + "voltage": 8, + "current": 5 + }, + { + "voltage": 8, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 5 + }, + { + "voltage": 10, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 3 + }, + { + "voltage": 9, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 3 + }, + { + "voltage": 5, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 8, + "current": 5 + }, + { + "voltage": 5, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 4 + }, + { + "voltage": 10, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 4 + }, + { + "voltage": 5, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 5 + }, + { + "voltage": 5, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 5 + }, + { + "voltage": 5, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 4 + }, + { + "voltage": 7, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 4 + }, + { + "voltage": 6, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 5 + }, + { + "voltage": 8, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 4 + }, + { + "voltage": 10, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 5, + "current": 5 + }, + { + "voltage": 5, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 4 + }, + { + "voltage": 7, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 3 + }, + { + "voltage": 6, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 7, + "current": 4 + }, + { + "voltage": 6, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 7, + "current": 5 + }, + { + "voltage": 7, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 5 + }, + { + "voltage": 6, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 4 + }, + { + "voltage": 10, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 4 + }, + { + "voltage": 8, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 5 + }, + { + "voltage": 7, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 4 + }, + { + "voltage": 9, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 3 + }, + { + "voltage": 7, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 4 + }, + { + "voltage": 5, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 7, + "current": 3 + }, + { + "voltage": 10, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 4 + }, + { + "voltage": 7, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 7, + "current": 3 + }, + { + "voltage": 7, + "current": 4 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 4 + }, + { + "voltage": 7, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 6, + "current": 3 + }, + { + "voltage": 7, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 10, + "current": 3 + }, + { + "voltage": 5, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 4 + }, + { + "voltage": 7, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 8, + "current": 5 + }, + { + "voltage": 9, + "current": 3 + } + ] + }, + { + "batteries": [ + { + "voltage": 9, + "current": 4 + }, + { + "voltage": 5, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 5, + "current": 5 + }, + { + "voltage": 5, + "current": 5 + } + ] + }, + { + "batteries": [ + { + "voltage": 7, + "current": 3 + }, + { + "voltage": 6, + "current": 4 + } + ] + } +] diff --git a/tests/simulation/data/wind_sensors.json b/tests/simulation/data/wind_sensors.json index 67e4449..5208b06 100644 --- a/tests/simulation/data/wind_sensors.json +++ b/tests/simulation/data/wind_sensors.json @@ -1,434 +1,434 @@ [ - { - "windSensors": [ - { - "speed": 15, - "direction": -57 - }, - { - "speed": 11, - "direction": -34 - } - ] - }, - { - "windSensors": [ - { - "speed": 18, - "direction": -1 - }, - { - "speed": 10, - "direction": -143 - } - ] - }, - { - "windSensors": [ - { - "speed": 13, - "direction": 2 - }, - { - "speed": 19, - "direction": -136 - } - ] - }, - { - "windSensors": [ - { - "speed": 22, - "direction": 23 - }, - { - "speed": 17, - "direction": 174 - } - ] - }, - { - "windSensors": [ - { - "speed": 13, - "direction": 74 - }, - { - "speed": 22, - "direction": 15 - } - ] - }, - { - "windSensors": [ - { - "speed": 12, - "direction": -136 - }, - { - "speed": 16, - "direction": -169 - } - ] - }, - { - "windSensors": [ - { - "speed": 21, - "direction": -29 - }, - { - "speed": 15, - "direction": -123 - } - ] - }, - { - "windSensors": [ - { - "speed": 11, - "direction": 68 - }, - { - "speed": 14, - "direction": 85 - } - ] - }, - { - "windSensors": [ - { - "speed": 14, - "direction": 142 - }, - { - "speed": 20, - "direction": -139 - } - ] - }, - { - "windSensors": [ - { - "speed": 10, - "direction": 117 - }, - { - "speed": 13, - "direction": 12 - } - ] - }, - { - "windSensors": [ - { - "speed": 22, - "direction": -175 - }, - { - "speed": 21, - "direction": -161 - } - ] - }, - { - "windSensors": [ - { - "speed": 20, - "direction": -140 - }, - { - "speed": 19, - "direction": -29 - } - ] - }, - { - "windSensors": [ - { - "speed": 12, - "direction": -34 - }, - { - "speed": 14, - "direction": 31 - } - ] - }, - { - "windSensors": [ - { - "speed": 11, - "direction": 149 - }, - { - "speed": 13, - "direction": 106 - } - ] - }, - { - "windSensors": [ - { - "speed": 20, - "direction": -30 - }, - { - "speed": 11, - "direction": 125 - } - ] - }, - { - "windSensors": [ - { - "speed": 17, - "direction": -168 - }, - { - "speed": 19, - "direction": -160 - } - ] - }, - { - "windSensors": [ - { - "speed": 16, - "direction": 3 - }, - { - "speed": 13, - "direction": 138 - } - ] - }, - { - "windSensors": [ - { - "speed": 14, - "direction": -125 - }, - { - "speed": 21, - "direction": -108 - } - ] - }, - { - "windSensors": [ - { - "speed": 18, - "direction": -126 - }, - { - "speed": 16, - "direction": -123 - } - ] - }, - { - "windSensors": [ - { - "speed": 10, - "direction": 21 - }, - { - "speed": 22, - "direction": -178 - } - ] - }, - { - "windSensors": [ - { - "speed": 16, - "direction": -5 - }, - { - "speed": 21, - "direction": -111 - } - ] - }, - { - "windSensors": [ - { - "speed": 19, - "direction": -36 - }, - { - "speed": 19, - "direction": 111 - } - ] - }, - { - "windSensors": [ - { - "speed": 13, - "direction": 1 - }, - { - "speed": 18, - "direction": 7 - } - ] - }, - { - "windSensors": [ - { - "speed": 17, - "direction": 69 - }, - { - "speed": 15, - "direction": -49 - } - ] - }, - { - "windSensors": [ - { - "speed": 10, - "direction": 163 - }, - { - "speed": 10, - "direction": -96 - } - ] - }, - { - "windSensors": [ - { - "speed": 16, - "direction": -157 - }, - { - "speed": 18, - "direction": 73 - } - ] - }, - { - "windSensors": [ - { - "speed": 19, - "direction": 67 - }, - { - "speed": 15, - "direction": -39 - } - ] - }, - { - "windSensors": [ - { - "speed": 14, - "direction": -104 - }, - { - "speed": 14, - "direction": 164 - } - ] - }, - { - "windSensors": [ - { - "speed": 22, - "direction": 167 - }, - { - "speed": 15, - "direction": 2 - } - ] - }, - { - "windSensors": [ - { - "speed": 19, - "direction": 179 - }, - { - "speed": 21, - "direction": 29 - } - ] - }, - { - "windSensors": [ - { - "speed": 19, - "direction": -34 - }, - { - "speed": 16, - "direction": -115 - } - ] - }, - { - "windSensors": [ - { - "speed": 11, - "direction": 175 - }, - { - "speed": 12, - "direction": -51 - } - ] - }, - { - "windSensors": [ - { - "speed": 15, - "direction": -159 - }, - { - "speed": 15, - "direction": -102 - } - ] - }, - { - "windSensors": [ - { - "speed": 21, - "direction": 67 - }, - { - "speed": 17, - "direction": -129 - } - ] - }, - { - "windSensors": [ - { - "speed": 17, - "direction": 133 - }, - { - "speed": 17, - "direction": 81 - } - ] - }, - { - "windSensors": [ - { - "speed": 13, - "direction": -172 - }, - { - "speed": 12, - "direction": -138 - } - ] - } -] \ No newline at end of file + { + "windSensors": [ + { + "speed": 15, + "direction": -57 + }, + { + "speed": 11, + "direction": -34 + } + ] + }, + { + "windSensors": [ + { + "speed": 18, + "direction": -1 + }, + { + "speed": 10, + "direction": -143 + } + ] + }, + { + "windSensors": [ + { + "speed": 13, + "direction": 2 + }, + { + "speed": 19, + "direction": -136 + } + ] + }, + { + "windSensors": [ + { + "speed": 22, + "direction": 23 + }, + { + "speed": 17, + "direction": 174 + } + ] + }, + { + "windSensors": [ + { + "speed": 13, + "direction": 74 + }, + { + "speed": 22, + "direction": 15 + } + ] + }, + { + "windSensors": [ + { + "speed": 12, + "direction": -136 + }, + { + "speed": 16, + "direction": -169 + } + ] + }, + { + "windSensors": [ + { + "speed": 21, + "direction": -29 + }, + { + "speed": 15, + "direction": -123 + } + ] + }, + { + "windSensors": [ + { + "speed": 11, + "direction": 68 + }, + { + "speed": 14, + "direction": 85 + } + ] + }, + { + "windSensors": [ + { + "speed": 14, + "direction": 142 + }, + { + "speed": 20, + "direction": -139 + } + ] + }, + { + "windSensors": [ + { + "speed": 10, + "direction": 117 + }, + { + "speed": 13, + "direction": 12 + } + ] + }, + { + "windSensors": [ + { + "speed": 22, + "direction": -175 + }, + { + "speed": 21, + "direction": -161 + } + ] + }, + { + "windSensors": [ + { + "speed": 20, + "direction": -140 + }, + { + "speed": 19, + "direction": -29 + } + ] + }, + { + "windSensors": [ + { + "speed": 12, + "direction": -34 + }, + { + "speed": 14, + "direction": 31 + } + ] + }, + { + "windSensors": [ + { + "speed": 11, + "direction": 149 + }, + { + "speed": 13, + "direction": 106 + } + ] + }, + { + "windSensors": [ + { + "speed": 20, + "direction": -30 + }, + { + "speed": 11, + "direction": 125 + } + ] + }, + { + "windSensors": [ + { + "speed": 17, + "direction": -168 + }, + { + "speed": 19, + "direction": -160 + } + ] + }, + { + "windSensors": [ + { + "speed": 16, + "direction": 3 + }, + { + "speed": 13, + "direction": 138 + } + ] + }, + { + "windSensors": [ + { + "speed": 14, + "direction": -125 + }, + { + "speed": 21, + "direction": -108 + } + ] + }, + { + "windSensors": [ + { + "speed": 18, + "direction": -126 + }, + { + "speed": 16, + "direction": -123 + } + ] + }, + { + "windSensors": [ + { + "speed": 10, + "direction": 21 + }, + { + "speed": 22, + "direction": -178 + } + ] + }, + { + "windSensors": [ + { + "speed": 16, + "direction": -5 + }, + { + "speed": 21, + "direction": -111 + } + ] + }, + { + "windSensors": [ + { + "speed": 19, + "direction": -36 + }, + { + "speed": 19, + "direction": 111 + } + ] + }, + { + "windSensors": [ + { + "speed": 13, + "direction": 1 + }, + { + "speed": 18, + "direction": 7 + } + ] + }, + { + "windSensors": [ + { + "speed": 17, + "direction": 69 + }, + { + "speed": 15, + "direction": -49 + } + ] + }, + { + "windSensors": [ + { + "speed": 10, + "direction": 163 + }, + { + "speed": 10, + "direction": -96 + } + ] + }, + { + "windSensors": [ + { + "speed": 16, + "direction": -157 + }, + { + "speed": 18, + "direction": 73 + } + ] + }, + { + "windSensors": [ + { + "speed": 19, + "direction": 67 + }, + { + "speed": 15, + "direction": -39 + } + ] + }, + { + "windSensors": [ + { + "speed": 14, + "direction": -104 + }, + { + "speed": 14, + "direction": 164 + } + ] + }, + { + "windSensors": [ + { + "speed": 22, + "direction": 167 + }, + { + "speed": 15, + "direction": 2 + } + ] + }, + { + "windSensors": [ + { + "speed": 19, + "direction": 179 + }, + { + "speed": 21, + "direction": 29 + } + ] + }, + { + "windSensors": [ + { + "speed": 19, + "direction": -34 + }, + { + "speed": 16, + "direction": -115 + } + ] + }, + { + "windSensors": [ + { + "speed": 11, + "direction": 175 + }, + { + "speed": 12, + "direction": -51 + } + ] + }, + { + "windSensors": [ + { + "speed": 15, + "direction": -159 + }, + { + "speed": 15, + "direction": -102 + } + ] + }, + { + "windSensors": [ + { + "speed": 21, + "direction": 67 + }, + { + "speed": 17, + "direction": -129 + } + ] + }, + { + "windSensors": [ + { + "speed": 17, + "direction": 133 + }, + { + "speed": 17, + "direction": 81 + } + ] + }, + { + "windSensors": [ + { + "speed": 13, + "direction": -172 + }, + { + "speed": 12, + "direction": -138 + } + ] + } +] diff --git a/views/DashboardContainer.tsx b/views/DashboardContainer.tsx index 5a03275..d6c7f5e 100644 --- a/views/DashboardContainer.tsx +++ b/views/DashboardContainer.tsx @@ -17,26 +17,26 @@ class DashboardContainer extends React.PureComponent { const { gps, batteries, windSensors } = this.props; const gpsChartData = [ - gps.data.map(data => this._parseISOString(data.timestamp)), - gps.data.map(data => data.speed), + gps.data.map((data) => this._parseISOString(data.timestamp)), + gps.data.map((data) => data.speed), ]; const batteriesVoltageData = [ - batteries.data.map(data => this._parseISOString(data.timestamp)), - batteries.data.map(data => data.batteries[0].voltage), - batteries.data.map(data => data.batteries[1].voltage), + batteries.data.map((data) => this._parseISOString(data.timestamp)), + batteries.data.map((data) => data.batteries[0].voltage), + batteries.data.map((data) => data.batteries[1].voltage), ]; const batteriesCurrentData = [ - batteries.data.map(data => this._parseISOString(data.timestamp)), - batteries.data.map(data => data.batteries[0].current), - batteries.data.map(data => data.batteries[1].current), + batteries.data.map((data) => this._parseISOString(data.timestamp)), + batteries.data.map((data) => data.batteries[0].current), + batteries.data.map((data) => data.batteries[1].current), ]; const windSensorsSpeedData = [ - windSensors.data.map(data => this._parseISOString(data.timestamp)), - windSensors.data.map(data => data.windSensors[0].speed), - windSensors.data.map(data => data.windSensors[1].speed), + windSensors.data.map((data) => this._parseISOString(data.timestamp)), + windSensors.data.map((data) => data.windSensors[0].speed), + windSensors.data.map((data) => data.windSensors[1].speed), ]; return ( @@ -44,33 +44,33 @@ class DashboardContainer extends React.PureComponent {

Dashboard Page

); } _parseISOString(s: string) { - return Math.floor(Date.parse(s) / 1000) // Converts to seconds + return Math.floor(Date.parse(s) / 1000); // Converts to seconds } } diff --git a/views/components/LineChart/MultiLineChart.tsx b/views/components/LineChart/MultiLineChart.tsx index 67cc17f..76279e2 100644 --- a/views/components/LineChart/MultiLineChart.tsx +++ b/views/components/LineChart/MultiLineChart.tsx @@ -1,5 +1,4 @@ import React from 'react'; -<<<<<<< HEAD import { LineChart, Line, @@ -10,9 +9,6 @@ import { Legend, ResponsiveContainer, } from 'recharts'; -======= -import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; ->>>>>>> 5275ad8 (LineCharts for GPS, Batteries, and WindSensor Data) export interface MultiLineChartProps { data: any[]; @@ -23,7 +19,6 @@ export interface MultiLineChartProps { export interface MultiLineChartState {} -<<<<<<< HEAD export default class MultiLineChartComponent extends React.Component< MultiLineChartProps, MultiLineChartState @@ -32,33 +27,17 @@ export default class MultiLineChartComponent extends React.Component< const { data, xAxisKey, yAxisKey1, yAxisKey2 } = this.props; return ( -======= -export default class MultiLineChartComponent extends React.Component { - render() { - const { data, xAxisKey, yAxisKey1, yAxisKey2 } = this.props; - return ( - ->>>>>>> 5275ad8 (LineCharts for GPS, Batteries, and WindSensor Data) -<<<<<<< HEAD -======= - ->>>>>>> 5275ad8 (LineCharts for GPS, Batteries, and WindSensor Data) -<<<<<<< HEAD -======= - - ->>>>>>> 5275ad8 (LineCharts for GPS, Batteries, and WindSensor Data) ); diff --git a/views/components/LineChart/UPlotLineChart.tsx b/views/components/LineChart/UPlotLineChart.tsx index b8e00b2..f624e29 100644 --- a/views/components/LineChart/UPlotLineChart.tsx +++ b/views/components/LineChart/UPlotLineChart.tsx @@ -24,30 +24,30 @@ export default class UPlotLineChartComponent extends React.Component< width: 800, height: 250, scales: { - x: { - time: true, - }, - y: {}, + x: { + time: true, + }, + y: {}, }, axes: [{}], series: [ - {}, - { - show: true, - spanGaps: false, - label: this.props.label, - value: (self, rawValue) => { - if (!rawValue) { - return `-- ${this.props.unit}`; - } - return rawValue?.toFixed(2) + ` ${this.props.unit}`; - }, - stroke: "red", - width: 1, - band: true, - } + {}, + { + show: true, + spanGaps: false, + label: this.props.label, + value: (self, rawValue) => { + if (!rawValue) { + return `-- ${this.props.unit}`; + } + return rawValue?.toFixed(2) + ` ${this.props.unit}`; + }, + stroke: 'red', + width: 1, + band: true, + }, ], - } + }, }; /** @@ -62,11 +62,11 @@ export default class UPlotLineChartComponent extends React.Component< render() { return ( - + ); } } diff --git a/views/components/LineChart/UPlotMultiLineChart.tsx b/views/components/LineChart/UPlotMultiLineChart.tsx index 9b166cf..1672511 100644 --- a/views/components/LineChart/UPlotMultiLineChart.tsx +++ b/views/components/LineChart/UPlotMultiLineChart.tsx @@ -22,48 +22,48 @@ export default class UPlotMultiLineChartComponent extends React.Component< readonly state: IUPlotMultiLineChartState = { chart: null, options: { - width: 800, - height: 250, - scales: { - x: { - time: true, - }, - y: {}, + width: 800, + height: 250, + scales: { + x: { + time: true, }, - axes: [{}], - series: [ - {}, - { - show: true, - spanGaps: false, - label: this.props.labelOne, - value: (self, rawValue) => { - if (!rawValue) { - return `-- ${this.props.unit}`; - } - return rawValue?.toFixed(2) + ` ${this.props.unit}`; - }, - stroke: "red", - width: 1, - band: true, - }, - { - show: true, - spanGaps: false, - label: this.props.labelTwo, - value: (self, rawValue) => { - if (!rawValue) { - return `-- ${this.props.unit}`; - } - return rawValue?.toFixed(2) + ` ${this.props.unit}`; - }, - stroke: "green", - width: 1, - band: true, - }, - ], - } - } + y: {}, + }, + axes: [{}], + series: [ + {}, + { + show: true, + spanGaps: false, + label: this.props.labelOne, + value: (self, rawValue) => { + if (!rawValue) { + return `-- ${this.props.unit}`; + } + return rawValue?.toFixed(2) + ` ${this.props.unit}`; + }, + stroke: 'red', + width: 1, + band: true, + }, + { + show: true, + spanGaps: false, + label: this.props.labelTwo, + value: (self, rawValue) => { + if (!rawValue) { + return `-- ${this.props.unit}`; + } + return rawValue?.toFixed(2) + ` ${this.props.unit}`; + }, + stroke: 'green', + width: 1, + band: true, + }, + ], + }, + }; /** * Sets the chart reference in the component's state.