Created
July 10, 2024 21:28
-
-
Save BK1031/6694281037532e3ba56cd8ba1ff3c71d to your computer and use it in GitHub Desktop.
racecar_analytics chart component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
LineChart, | |
Line, | |
XAxis, | |
YAxis, | |
CartesianGrid, | |
Tooltip, | |
ResponsiveContainer, | |
} from "recharts"; | |
const Chart = () => { | |
return ( | |
<div className="mx-2 text-center"> | |
<h4 className="my-2">Motor RPM</h4> | |
<ResponsiveContainer width="100%" height={250}> | |
<LineChart | |
width={500} | |
height={300} | |
data={ecuData} | |
> | |
<CartesianGrid strokeDasharray="4 3" stroke="#343434" /> | |
<XAxis | |
dataKey="created_at" | |
stroke="white" | |
tick={{ fill: "gray" }} | |
tickFormatter={(timestamp) => | |
new Date(timestamp).toLocaleTimeString() | |
} | |
/> | |
<YAxis | |
stroke="white" | |
tick={{ fill: "gray" }} | |
domain={["dataMin", "dataMax"]} | |
allowDataOverflow={true} | |
/> | |
<Tooltip /> | |
<Line | |
type="monotone" | |
dataKey="motor_rpm" | |
stroke="#820DDF" | |
strokeWidth={2} | |
isAnimationActive={false} | |
animateNewValues={false} | |
/> | |
</LineChart> | |
</ResponsiveContainer> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment