SWE-PolyVision / tasks /chartjs__Chart.js-3192 /problem_statement.txt
jiajunwu1's picture
SWE-PolyVision public task set (48 tasks): statements, assets and environment only
45721da
Raw History Blame Contribute Delete
2.49 kB
Padding inside the canvas with a line chart without scale
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
```
new Chart(ctx, {
// responsive: false,
type: 'line',
// maintainAspectRatio:false,
data: {
labels: labels,
datasets: [{
fill:true,
backgroundColor: "#47afbd",
data: data
}]
},
options: {
defaultFontSize:10,
animation:{
onProgress:function(){
if(self.$('#engagement-chart-wrap').hasClass('isLoading')){
self.$('#engagement-chart-wrap').removeClass('isLoading');
}
}
},
legend: {
display: false
},
tooltips:{
enabled:false
},
elements:{
point:{
radius:0
}
},
scales: {
yAxes: [{
ticks :{
display:false,
padding:0
},
gridLines:{
drawTicks:false,
drawBorder:false
},
scaleLabel:{
display:false
}
}],
xAxes: [{
ticks :{
display:false,
padding:0
},
gridLines:{
display:false,
drawTicks:false,
drawBorder:false
}
}]
}
}
});
```
## Relevant pre-fix discussion
### Issue #2872
#### Comment at 2016-06-29T15:19:50Z
I'm also getting padding issues without a scale. But mine are out of range.
How can we add padding to the canvas? (Chart v2)
With scale. e.g.
```
xAxes: [{
display: true
```
![image](assets/chartjs__Chart.js-3192/001.png)
Without e.g.
```
xAxes: [{
display: false
```
![image](assets/chartjs__Chart.js-3192/002.png)
Only seems to happen when both x and y axis display is equal to false.