-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Padding inside the canvas with a line chart without scale #2872
Comments
Anything? |
There are currently no options to do this. If someone wants to submit a PR, I can look at it |
Thanks for the reply. Isn't this a bug, rather than an option though? |
Possibly. But it might be a duplicate of #2768 |
Not Really... My chart appears always inside the limits but doesn't fill the canvas element. |
I found the bug here. It's that the options: {
scales: {
yAxes: [{
gridLines: {
tickMarkLength: 0
}
}]
}
} |
I was not able to make work the chart with @etimberg configuration. Instead I set to display none all the lines of my chart: scales: {
xAxes: [{
gridLines: {
display: false,
drawBorder: false,
},
scaleLabel: {
display: false
},
ticks: {
display: false
}
}],
yAxes: [{
gridLines: {
display: false,
drawBorder: false
},
scaleLabel: {
display: false
},
ticks: {
display: false
}
}],
}, |
@carlesnunez's solution partially worked for me. I'm still running into an issue on the top of the chart. ^ Sides and bottom not cut off ^ Top cut off :( I'll post back when we figure it out, but if anyone else could help, I'm all ears. |
FYI I just realized that I can dynamically set |
Adding negative left and bottom layout padding(http://www.chartjs.org/docs/#chart-configuration-layout-configuration) seems to be working. |
I'm still hitting this issue. Padding does not fix it. I'm having to dynamically adjust the yAxes ticks min/max by ~5, as @ryana had mentioned earlier. const min = Math.min(...data)
const max = Math.max(...data)
options.scales.yAxes[0].ticks.min = min - 5
options.scales.yAxes[0].ticks.max = max + 5 BeforeAfter |
I also still face this issue, and no padding setting seems to address it. I also continually modify the data in the chart, so keeping track of setting the minimum and maximum tick is a non-workable workaround for me.
This configuration yields a chart where the top and bottom are partly cut off; |
Anyone able to sort this out? |
So is it still not possible to make the graph completely fill the canvas element without losing the gridlines or using some other hack? I am using chart.js 2.6.0 and the graph does not scale to the edges of the canvas element, which makes it an aesthetical pain. |
Adding the layout padding works for me
|
I have similar problem (at least I think): The top grid line is cut. Version: [email protected] As you see the line on top with 100% value is cut by half and points have holes in the center. My workaround: options: {
scales: {
yAxes: [{
ticks: {
min: 0,
max: 105,
callback: function(value, index, values) {
if (value == 105) {
return '';
}
return value + '%';
}
}
}]
}
} It looks like: To be perfect I would remove the last grid line for 105. Do you know if it is possible? |
It worked! Thanks alot |
Sorry for the grave-digging but for me none of the above solutions worked.
|
Hello,
How can i make the line graph stick to the exact border of the canvas ?
I 've made a line graph without scales and there are always a gap between the left and the bottom borders of the canvas and the beginning of the charts... I try to play with the responsive and the maintainAspectRatio options without success... here is my configuration .
Thx
The text was updated successfully, but these errors were encountered: