How to have the LineChart centered #5225
-
I'm struggling with this and can't find how to center the LineChart in the middle of the graph. <ResponsiveContainer width="100%" height="100%">
<LineChart data={chartData}>
<CartesianGrid vertical={false} strokeDasharray="2 2" />
<XAxis
dataKey="month"
axisLine={false}
tickLine={false}
tickMargin={16}
padding={{ left: 30, right: 30 }}
/>
<YAxis axisLine={false} tickLine={false} tickMargin={5} tick={<CustomizedYAxisTick />} />
<Tooltip content={<CustomTooltip />} />
<Line
type="monotone"
dataKey="userTotalInvestment"
stroke={theme["--color-primary-500"]}
activeDot={{ r: 8 }}
dot={{ stroke: theme["--color-primary-500"], strokeWidth: 12 }}
isAnimationActive
/>
</LineChart>
</ResponsiveContainer> |
Beta Was this translation helpful? Give feedback.
Answered by
ckifer
Nov 8, 2024
Replies: 1 comment 1 reply
-
You would have to change the domain on your Y axis. You could do something like domain={([dataMin, dataMax]) => [0, dataMax * 2]} Or something like that |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
arthur-overlord
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You would have to change the domain on your Y axis. You could do something like domain={([dataMin, dataMax]) => [0, dataMax * 2]}
Or something like that