47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
$.ajax({
|
|
url: 'data/top_articles.json',
|
|
dataType: 'json'
|
|
}).done(function (results) {
|
|
new Chart(document.getElementById("top_articles_chart"), {
|
|
type: 'horizontalBar',
|
|
data: {
|
|
labels: results.labels,
|
|
datasets: [{
|
|
label: results.label1,
|
|
backgroundColor: 'rgba(244, 177, 131, 1)',
|
|
stack: 'Stack 0',
|
|
data: results.data1
|
|
}, {
|
|
label: results.label2,
|
|
backgroundColor: 'rgba(255, 217, 102, 1)',
|
|
stack: 'Stack 1',
|
|
data: results.data2
|
|
}, {
|
|
label: results.label3,
|
|
backgroundColor: 'rgba(196, 209, 142, 1)',
|
|
stack: 'Stack 2',
|
|
data: results.data3
|
|
}]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
title: {
|
|
display: false,
|
|
text: 'Top Artikel'
|
|
},
|
|
legend: {
|
|
position: 'bottom',
|
|
},
|
|
scales: {
|
|
yAxes: [{
|
|
gridLines: {
|
|
display: false
|
|
},
|
|
ticks: {
|
|
beginAtZero: true
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
});
|
|
}); |