More typing and fixes
This commit is contained in:
@@ -10,8 +10,11 @@ import {
|
||||
XAxis,
|
||||
YAxis,
|
||||
} from 'recharts';
|
||||
import type { HourlyForecast } from 'types';
|
||||
|
||||
export default function WeatherGraphs({ hourlyForecast }: any) {
|
||||
export default function WeatherGraphs({
|
||||
hourlyForecast,
|
||||
}: { hourlyForecast: HourlyForecast[] }) {
|
||||
function CustomTooltip({ payload, active }: any) {
|
||||
if (active) {
|
||||
return (
|
||||
@@ -48,7 +51,7 @@ export default function WeatherGraphs({ hourlyForecast }: any) {
|
||||
<XAxis
|
||||
type='category'
|
||||
stroke={'var(--color-text-pri)'}
|
||||
dataKey={(data: any) => {
|
||||
dataKey={(data: HourlyForecast) => {
|
||||
return new Date(data.startTime).toLocaleTimeString('en-US', {
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
@@ -74,7 +77,7 @@ export default function WeatherGraphs({ hourlyForecast }: any) {
|
||||
unit={'°F'}
|
||||
type='monotone'
|
||||
name='Dew Point'
|
||||
dataKey={(data: any) => {
|
||||
dataKey={(data: HourlyForecast) => {
|
||||
return (data.dewpoint.value * 9) / 5 + 32;
|
||||
}}
|
||||
stroke={'var(--color-text-acc)'}
|
||||
@@ -88,7 +91,7 @@ export default function WeatherGraphs({ hourlyForecast }: any) {
|
||||
<XAxis
|
||||
type='category'
|
||||
stroke={'var(--color-text-pri)'}
|
||||
dataKey={(data: any) => {
|
||||
dataKey={(data: HourlyForecast) => {
|
||||
return new Date(data.startTime).toLocaleTimeString('en-US', {
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
@@ -102,7 +105,7 @@ export default function WeatherGraphs({ hourlyForecast }: any) {
|
||||
unit={'%'}
|
||||
type='monotone'
|
||||
name='Precipitation'
|
||||
dataKey={(data: any) => {
|
||||
dataKey={(data: HourlyForecast) => {
|
||||
return data.probabilityOfPrecipitation.value;
|
||||
}}
|
||||
stroke={'var(--color-text-pri)'}
|
||||
@@ -113,7 +116,7 @@ export default function WeatherGraphs({ hourlyForecast }: any) {
|
||||
unit={'%'}
|
||||
type='monotone'
|
||||
name='Humidity'
|
||||
dataKey={(data: any) => {
|
||||
dataKey={(data: HourlyForecast) => {
|
||||
return data.relativeHumidity.value;
|
||||
}}
|
||||
stroke={'var(--color-text-acc)'}
|
||||
|
||||
Reference in New Issue
Block a user