Help with removing padding on y-axis
See original GitHub issueI have struggled a lot trying to remove some padding that is added within the canvas when hidden the y-axis ticks.
I have even tried to modify the padding of the x-axis ticks with negativa numbers but then they wont align correctly with the data on the chart.
Please is there someone that could help? I tried SO but got no luck finding help there.
My code:
const ChartObj = new Chart(element, {
type: 'line',
data: chartData,
options: {
responsive: true,
maintainAspectRatio: false,
onClick: this.handleClick.bind(this, chartData),
legend: {
display: false
},
scales: {
yAxes: [{
gridLines: {
display: false,
drawBorder: false
},
scaleLabel: {
display: false
},
ticks: {
display: false
}
}],
xAxes: [{
gridLines: {
color: 'rgba(255, 255, 255, 0)',
zeroLineColor: 'rgba(255, 255, 255, 0)', // hide the zero line by making it white
zeroLineWidth: 0,
},
scaleLabel: {
display: false
},
ticks: {
// Only display time line with a 5 year span
callback: function(dataLabel, index) {
return (index+1) % 5 === 0 ? dataLabel : '';
},
}
}],
},
tooltips: {
mode: 'index',
intersect: false,
position: 'nearest',
callbacks: {
label: function(tooltipItem, data) {
if (data.datasets[tooltipItem.datasetIndex].label.length) {
return data.datasets[tooltipItem.datasetIndex].label + ': ' + currencyFormatter.format(tooltipItem.yLabel, { code: 'SEK', thousand: ' ', precision: 0 });
}
},
title: function(tooltipItem, data) {
return data.labels[tooltipItem[0]['index']] + ' år';
}
},
}
},
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
removing the y-axis margins - javascript - Stack Overflow
I've been trying to make a masonry type layout so I gave random height and colors to the divs but there seem to...
Read more >How to remove the padding from the Y-Axis title - Highcharts
The problem I am having is that I need to make sure that the padding is 0 on different font sizes that I...
Read more >Remove an extra padding in y-axis on Epic detail (!37886) · Merge ...
What does this MR do? Removes an extra padding in y-axis on Epic detail Web page. Ordering class name is just aligned with...
Read more >Remove padding to on inside of a chart - Bokeh Discourse
In the example below I would like to remove the left and right space/padding so that x=0 is inline with the y axis...
Read more >Set axis limits and aspect ratios - MATLAB axis - MathWorks
This syntax will be removed in a future release. ... Add Padding Around Stairstep Plot ... x = 0:12; y = sin(x); stairs(x,y)...
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
Hi. I use 2.7.0 version and this problem still available for me. How can I remove this padding? Thanks in advance.