<?php
if(isset($_GET['source'])) {
    die(
highlight_file('line.php'));
}

require_once(
'SVGGraph/SVGGraph.php');

$db = new SQLite3('db/koffie.db');
$stmt $db->prepare('SELECT * from koffie;');
$result $stmt->execute();
$values = array();
$total 46;
$tussens 0;
 while (
$row $result->fetchArray())
{
    
$laatstedatum $datum;
    
$datum substr($row['datum'],0,10);
    if(
$laatstedatum != '' && strtotime($laatstedatum)+3600*24 strtotime($datum) ) {
        
$cur strtotime($laatstedatum)+3600*24;
#        echo 'Op zoek naar: '.$datum.', '.strtotime($datum).'<br>';
        
while($cur strtotime($datum) && $tussens 1000) {
            
$tussens++;
            
$tussendatum date('Y-m-d',$cur);
#            echo $tussendatum.'<br>';
            
$values[$tussendatum] = $total;
            
$cur += 3600*24;
        }
    }
    
$total += $row['aantal'];
    
$values[$datum] = $total;
}

/*
$i = 0;
$cur = strtotime($values[$i]);
$max = strtotime($values[count($values)]);
while($cur < $max) {
    $cur+= 3600*24;
    if(!array_key_exists(date('Y-m-d',$cur))) {
*/
 
$settings = array(
  
'back_colour'       => '#eee',    'stroke_colour'      => '#000',
  
'back_stroke_width' => 0,         'back_stroke_colour' => '#eee',
  
'axis_colour'       => '#333',    'axis_overlap'       => 2,
  
'axis_font'         => 'Georgia''axis_font_size'     => 10,
  
'grid_colour'       => '#777',    'label_colour'       => '#000',
  
'pad_right'         => 20,        'pad_left'           => 20,
  
'link_base'         => '/',       'link_target'        => '_top',
  
'fill_under'        => array(truefalse),
  
'marker_size'       => 3,
  
'marker_type'       => array('circle''square'),
  
'marker_colour'     => array('blue''red'),
  
'minimum_grid_spacing_h' => 75
);
 
/*
$values = array(
 array('Dough' => 30, 'Ray' => 50, 'Me' => 40, 'So' => 25, 'Far' => 45, 'Lard' => 35),
 array('Dough' => 20, 'Ray' => 30, 'Me' => 20, 'So' => 15, 'Far' => 25, 'Lard' => 35,
  'Tea' => 45)
);
*/
 
$colours = array(array('red''yellow'), array('blue''white'));
 
$graph = new SVGGraph(1200400$settings);
$graph->colours $colours;
 
$graph->Values($values);
$graph->Links($links);
$graph->Render('LineGraph');
?>
1