add the very basics of a plot
Also troubleshoot to fix vite config for deduplicating react and react-dom
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { ScatterChart, Scatter, XAxis, YAxis, Tooltip, ResponsiveContainer } from "recharts";
|
||||
import WeatherHistory from '@/hooks/weather-history'
|
||||
|
||||
function TemperaturePlot() {
|
||||
const {data, isLoading, error} = WeatherHistory()
|
||||
|
||||
if (isLoading) return <p>Loading...</p>
|
||||
if (error) return <p>Error: {error.message}</p>
|
||||
|
||||
return (
|
||||
<div>
|
||||
<ResponsiveContainer width="100%" height={400}>
|
||||
<ScatterChart data={data}>
|
||||
<XAxis dataKey="id" />
|
||||
<YAxis />
|
||||
<Tooltip />
|
||||
<Scatter dataKey="temp" fill="#6366f1" />
|
||||
</ScatterChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default TemperaturePlot
|
||||
|
||||
Reference in New Issue
Block a user