@@ -2,13 +2,17 @@ import React from 'react';
|
||||
import {
|
||||
LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend,
|
||||
} from 'recharts';
|
||||
import {
|
||||
useParams
|
||||
} from "react-router-dom";
|
||||
|
||||
export default function (day, kind) {
|
||||
export default function ResourceChart(props) {
|
||||
|
||||
const [data, setData] = React.useState(null);
|
||||
|
||||
let { id } = useParams();
|
||||
const loadData = async () => {
|
||||
let nextData = await fetch(`/API/day?date=${day}&kind=${kind}`);
|
||||
console.log(id)
|
||||
let nextData = await fetch(`/API/day?date=${props["day"]}&kind=${id}`);
|
||||
nextData = await nextData.json();
|
||||
for (let i = 0; i < nextData.length; i++) {
|
||||
nextData[i]["time"] = new Date(nextData[i]["time"]);
|
||||
@@ -38,4 +42,4 @@ export default function (day, kind) {
|
||||
<Line type="monotone" dataKey="price" stroke="#8884d8" dot={false} />
|
||||
</LineChart>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user