Couldn't understand what "type" property of <XAxis /> and <YAxis /> does #3507
Closed
M-o-h-a-n-S-i-n-g-h
started this conversation in
General
Replies: 1 comment 1 reply
-
Hi @M-o-h-a-n-S-i-n-g-h ! Sorry that this is not explained in detail in the document. We are improving the document recently. Thank you for your question! The key is to set the type of the two axes after you set the layout. So the code will be: <BarChart
width={500}
height={300}
data={data}
margin={{
top: 5,
right: 30,
left: 20,
bottom: 5,
}}
layout="vertical"
>
<CartesianGrid strokeDasharray="3 3" />
<XAxis type="number" />
<YAxis type="category" dataKey="name" />
<Tooltip />
<Legend />
<Bar dataKey="pv" fill="#8884d8" />
<Bar dataKey="uv" fill="#82ca9d" />
</BarChart> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey Folks!,
I was going through the
<SimpleBarChart />
component and I need to make the chart to vertical layout.After changing the
type
prop of both<XAxis />
and<YAxis />
component it actually worked.But eager to know what actually does the
type
prop does. There is no detailed docs for this in the API section of<XAxis />
and<YAxis />
Thanks in Advance!!
Beta Was this translation helpful? Give feedback.
All reactions