var barChartData = {
labels: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
datasets: [{
label: 'Realizado',
backgroundColor: [
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)',
'rgba(99,124,198,0.5)'
],
borderColor: [
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)',
'rgba(99,124,198,1)'
],
data: [4683, 6412, 8988, 8288, 6612, 7642, 4954, 0, 0, 0, 0, 0]
}, {
label: 'Media/Dia',
backgroundColor: [
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)',
'rgba(229,58,53,0.5)'
],
borderColor: [
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)',
'rgba(229,58,53,1)'
],
data: [312, 305, 409, 377, 301, 318, 550, 0, 0, 0, 0, 0]
}, {
label: 'Programado',
backgroundColor: [
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)',
'rgba(85,208,161,0.5)'
],
borderColor: [
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)',
'rgba(85,208,161,1)'
],
data: [8000, 8000, 8000, 7587, 7393, 8411, 9152, 0, 0, 0, 0, 0]
}]
};
window.onload = function() {
var ctx = document.getElementById("canvas").getContext("2d");
window.myBar = new Chart(ctx, {
type: 'bar',
data: barChartData,
options: {
barValueSpacing: 0,
showAllTooltips: true,
elements: {
rectangle: {
borderWidth: 2,
borderColor: 'rgb(0, 255, 0)',
borderSkipped: 'bottom'
}
},
scales: {
xAxes: [{
gridLines: {
show: true,
color: "#FF0000"
}
}],
yAxes: [{
gridLines: {
show: true,
color: "#fff"
}
}]
},
responsive: true,
legend: {
position: 'top',
},
animation: {
onComplete: function () {
var chartInstance = this.chart;
var ctx = chartInstance.ctx;
ctx.textAlign = "center";
ctx.font = "bold 20px Arial";
ctx.fillStyle = "white";
Chart.helpers.each(this.data.datasets.forEach(function (dataset, i) {
var meta = chartInstance.controller.getDatasetMeta(i);
Chart.helpers.each(meta.data.forEach(function (bar, index) {
ctx.fillText(dataset.data[index], bar._model.x, bar._model.y - 30);
}),this)
}),this);
}
},
title: {
display: true,
text: 'Embarques: Realizado / Media Dia X Programado'
},
annotation: {
annotations: [{
type: 'line',
mode: 'horizontal',
scaleID: 'y-axis-1',
value: '1200',
borderColor: 'red',
borderWidth: 1
}]
}
}
});
};`