-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[charts] Misconception about default axis ids #12531
Comments
The issue come from the Since you provide an axis with Using For a long term fix. I think we could go with the |
@alexfauquette apologies, I somehow managed to link to the wrong sandbox. I've updated my post with the correct link For reference, this is what I previously had (I've since updated the sandbox to the working version) <BarChart
dataset={dataset}
yAxis={[{ scaleType: "band", dataKey: "month" }]}
series={[
{ dataKey: "seoul", label: "Seoul rainfall", valueFormatter },
]}
layout="horizontal"
leftAxis={null}
bottomAxis={null}
topAxis={DEFAULT_X_AXIS_KEY}
rightAxis={DEFAULT_Y_AXIS_KEY}
margin={{ top: 30, bottom: 10 }}
xAxis={[{
label: "rainfall (mm)"
}]}
width={500}
height={400}
/> I was copying exactly what Scatter chart does to move the axis, so I didn't initially add I tried your suggestion and it gave me this error. looks like there's a typo.
Removing "f" from "defaultized" fixed it. For those that want the correct code, here is what I ended up having to use <BarChart
dataset={dataset}
yAxis={[{ scaleType: "band", dataKey: "month" }]}
series={[
{ dataKey: "seoul", label: "Seoul rainfall", valueFormatter },
]}
layout="horizontal"
leftAxis={null}
rightAxis="deaultized-y-axis-0"
margin={{ bottom: 90 }}
slotProps={{
legend: {
position: {
horizontal: "middle",
vertical: "bottom",
},
},
}}
xAxis={[
{
label: "rainfall (mm)",
reverse: true,
},
]}
width={500}
height={400}
/> |
You don't use reverse, but the y-axis is defined
I should update the demo because the axis ids are too confusing. Or at list I should add a comment to explain its limitation.
Yes, that's a typo that got fixed in the v7 #12461
No wories. For a reason I ignore most of the codesandbox I open today have the error "Invalid left-hand side in assignment" So I'm running the provided code in local env which is imperfect. That's why you are in a version with the typo and not me |
I have a similar problem right now and I want to hide the ticks and axis lines but not the month. any suggestions? |
What did you try? |
used the styling for axis lines and ticks
|
It seems to be working: https://stackblitz.com/edit/react-pbjrbl?file=Demo.tsx @MRanjith26 since your issue is not directly related to this one, could you please open a new one with a minimal reproduction example (the stackblitz link above should be a good starting point) and an explanation about what is not working as expected in your example |
@NerdCowboy: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
Link to live example: (required)
CodeSandbox
Steps:
Current behavior
Axis customization for BarChart hides axis labels
Expected behavior
Axis customization should show axis labels and act exactly like the ScatterChart
Context
Still trying to do a reverse horizontal bar chart per my previous ticket
Your environment
npx @mui/envinfo
Search keywords: bar chart, axis, reverse
Order ID: 70251
The text was updated successfully, but these errors were encountered: