HI guys , Can someone assist , my chart is rendering but when 2 columns has the same value it only renders certain columns, Ive seen the solution on various platforms but i cant get it to work, if anyone can tell me how to add this code i would appreciate it
//TRYING TO IMPLEMENT
options: {
title: {
display: true,
text: 'Title Text'
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
//CURRENT CODE
<script>
$(document).ready(function() {
$.ajax({
url: "http://localhost/loginandout/admindatacharts.php",
method: "GET",
success: function(data) {
console.log(data);
var types = [];
var dtypes = [];
var ids = [];
var total = [];
for (var i in data) {
types.push(data[i].type);
dtypes.push(data[i].dtype);
ids.push(data[i].id);
total.push(data[i].total)
}
var chartdata = {
labels: types,
datasets: [{
label: 'Defects Logged',
backgroundColor: [
'red',
'yellow',
'blue',
'green',
'orange',
'teal',
],
borderColor: 'rgba(200, 200, 200, 0.75)',
hoverBackgroundColor: 'rgba(200, 200, 200, 1)',
hoverBorderColor: 'rgba(200, 200, 200, 1)',
data: total
}]
};
var ctx = $("#mycanvas");
var barGraph = new Chart(ctx, {
type: 'bar',
data: chartdata
});
},
error: function(data) {
console.log(data);
}
});
});
</script>