Files
dbois/public/js/lib/services/chartService.js
T
2018-01-31 11:10:17 +01:00

81 lines
2.2 KiB
JavaScript

/**
* Created by Pensare Software.
* User: Theo Weijmer
* Date: 30/01/2018
* Time: 16:03
*/
dbo.charts = {
drawHoursVsBudget : function(hours, budget, element){
var ctx = document.getElementById( element ).getContext( '2d' );
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["uren", "budget"],
datasets: [{
data: [hours, budget],
backgroundColor: [
'#f3a921', '#f2770c'
]
}]
},
options: {
maintainAspectRatio: false,
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
},
legend:{
display : false,
},
title: {
display: true,
text: 'Uren vs budget',
fontSize:16,
fontColor: '#b2b2b2'
}
}
});
},
drawInvoicesVsPayed : function(offer, invoice, payed, element){
var ctx = document.getElementById( element ).getContext( '2d' );
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ["offerte", "facturen", "betaald"],
datasets: [{
data: [offer, invoice, payed],
backgroundColor: [
'#f3a921', '#f2770c', '#72221a'
]
}]
},
options: {
maintainAspectRatio: false,
scales: {
yAxes: [{
ticks: {
beginAtZero:true
}
}]
},
legend:{
display : false,
},
title: {
display: true,
text: 'offerte vs facuren vs betalingen',
fontSize:16,
fontColor: '#b2b2b2'
}
}
});
}
}