y-axis is short
See original GitHub issueFirst of all, thanks for the library. Keep up the good work!
Describe/explain the bug The y-axis is shorter than the tallest bar
To Reproduce
import React, { Component } from "react";
import { ResponsiveBar } from "@nivo/bar";
import "./NivoBarChart.css";
const data = [
{ year: "2011", papers: 190 },
{ year: "2012", papers: 61 },
{ year: "2013", papers: 31 },
{ year: "2014", papers: 106 },
{ year: "2015", papers: 109 },
{ year: "2016", papers: 16 },
{ year: "2017", papers: 16 },
{ year: "2018", papers: 16 },
{ year: "2019", papers: 16 }
];
class NivoBarChart extends Component {
render() {
return (
<ResponsiveBar
data={data}
keys={["papers", ]}
indexBy="year"
margin={{ top: 50, right: 130, bottom: 50, left: 60 }}
padding={0.1}
colors={{scheme: "nivo"}}
colorBy="id"
borderRadius={10}
axisBottom={{
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
legend: "year",
legendPosition: "middle",
legendOffset: 32
}}
axisLeft={{
tickSize: 5,
tickPadding: 5,
tickRotation: 0,
}}
theme={{
tooltip: {
container: {
background: "black",
color: "white",
fontSize: "inherit",
borderRadius: "2px",
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.25)",
padding: "5px 9px"
},
basic: {
whiteSpace: "pre",
display: "flex",
alignItems: "center"
},
table: {},
tableCell: {
padding: "3px 5px"
}
},
axis: {
domain: {
line: {
stroke: "#000",
strokeWidth: 1
}
}
}
}}
enableGridX={false}
enableGridY={false}
label={false}
animate={true}
motionStiffness={90}
motionDamping={15}
isInteractive
// handling mouse-over effect: borderRadius
onMouseEnter={(d, e) => {
e.target.classList.remove("smooth");
e.target.classList.add("sharp");
}}
onMouseLeave={(d, e) => {
e.target.classList.remove("sharp");
e.target.classList.add("smooth");
}}
/>
);
}
}
export default NivoBarChart;
Expected behavior The biggest number is 190, but y-axis only goes up to 180. It should include 200 as well.
Screenshots
Desktop (please complete the following information):
- OS: Win 10
- Browser Opera
- Version 62
- Nivo Bar 0.59.2
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:33 (1 by maintainers)
Top Results From Across the Web
values on y-axis cut short when making horizontal barchart
I'm making a horizontal barchart with words on the y-axis and integers on the x-axis.
Read more >Y-Axis too short - Community of 3D Printing Experts
So I've been having headaches trying to get my machine calibrated correctly. I can't print circles, they always end up funky.
Read more >Fixing a y-axis that is too short in barplot function in R
The y-axis problem can be solved by manually defining an axis. I tried to set the upper bound to 13, my largest count...
Read more >[R] barplot y axis too short
[R] barplot y axis too short. David Winsemius dwinsemius at comcast.net. Tue Feb 2 02:43:18 CET 2010. Previous message: [R] barplot y axis...
Read more >yAxis.labels | highcharts API Reference
Instead, we lay out the axis label with word wrap. A lower limit makes sense when the label contains multiple short words that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue is still an issue - I used CaptainT33mo’s solution to as a way to circumvent the problem in my project, but it’d be nice to not have to manually round up the highest value for the graph to fit the data properly
+1 on this implementation, I think this would be the cleanest solution