1
0

Grafiek fix en sneller statistiek algorithme

This commit is contained in:
JelmerHinssen
2017-04-03 18:21:36 +02:00
parent 8552933a52
commit 4a20995bc3
4 changed files with 57 additions and 25 deletions

View File

@ -5,6 +5,7 @@
<title>Inforbank</title>
<link rel="stylesheet" href="<?= $header['base'] ?>assets/css/main.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="<?= $header['base']?>assets/moment.min.js"></script>
<script src="<?= $header['base']?>assets/chart.min.js"></script>
<base href="<?= $header['base'] ?>">
</head>

View File

@ -1,27 +1,42 @@
<?php include '__header.phtml'; ?>
<a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr?>" role="button">Terug</a>
<canvas id="myChart" height="100"></canvas>
<a class="btn btn-default pull-left" href="rekeningen/<?= $rekeningnr ?>" role="button">Terug</a>
<canvas id="grafiek" height="100"></canvas>
<script>
function newDate(days) {
return moment().add(days, 'd');
}
Chart.defaults.global.legend.display = false;//Geen legenda
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
var grafiek = document.getElementById("grafiek");
var myChart = new Chart(grafiek, {
type: "line",
options: {
title: {
display: true,
text: "Saldo van de afgelopen maand"
},
scales: {
xAxes: [{
type: "time",
unit: "day",
time: {
displayFormats: {
"day": "D MMM"
}
}
}],
yAxes: [{
ticks: {
beginAtZero:true
}
}]
}
},
data: {
//Laad de dagen in
labels: <?php echo json_encode($statistieken['x-as']); ?>,
datasets: [{
label: "Saldo",
//Laad de saldo's in
data: <?php echo json_encode($statistieken['y-as']); ?>,
borderWidth: 2,
lineTension: 0,
lineTension: 0, //Rechte lijnen
fill: false,
borderColor: "black",
pointRadius: 5,