1 year ago
#74731

Sead Silajdzic
ChartJS generated random number at <canvas>
can someone help me with randomly generated 0 at the top of the ChartJS canvas. Here is the js:
const chartConst= document.getElementById('canvasUnique').getContext('2d');
const chartInit= new Chart(chartInit, {
type: 'bar',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
datasets: [{
data: [10, 20, 30, 40, 50, 60],
backgroundColor: [
'#CDF8FC',
'#FFEAD1',
'#CDF8FC',
'#FFEAD1',
'#CDF8FC',
],
borderColor: [
'#CDF8FC',
'#FFEAD1',
'#CDF8FC',
'#FFEAD1',
'#CDF8FC',
],
borderWidth: 1,
datalabels: {
anchor: 'end',
align: 'left'
}
}],
},
plugins: [ChartDataLabels],
options: {
plugins: {
legend: {
display: false
}
},
responsive:true,
maintainAspectRatio: true,
indexAxis: 'y',
scales: {
y: {
beginAtZero: true,
grid: {
display: false,
drawBorder: false,
}
},
x: {
beginAtZero: true,
min: 0,
max: 100,
grid: {
display: false,
}
}
},
},
});
It seems like there is some kind of random number at the top and I can not change it with HTML/CSS and I have checked if there is some kind of unclosed string at the js part.
javascript
charts
chart.js
0 Answers
Your Answer