<?php
// VLOŽENÍ KNIHOVNY LIBCHART
require_once('libchart/libchart.php');

// DEFINICE BODŮ GRAFU
$Arr = Array('1. položka' => 20,
                 
'2. položka' => 50,
                 
'3. položka' => 30,
                 
'4. položka' => 100,
                 
'5. položka' => 70,
                 
'6. položka' => 60,
                 
'7. položka' => 10,
                 
'8. položka' => 50
                 
);


// HORIZONTÁLNÍ GRAF O ROZMĚRECH 600x300 px
$chart1 = new HorizontalChart(600300);

// VLOZENI BODU DO GRAFU
foreach ($Arr AS $k => $v)
{
    
$chart1->addPoint(new Point($k$v));
}
// NASTAVENÍ POPISKU GRAFU
$chart1->setTitle('Horizontální graf');
// LEVÝ OKRAJ
$chart1->setLabelMarginLeft(80);
// VYTVOŘENÍ SOUBORU S GRAFEM
$chart1->render('horizontal-chart.png');

// VERTIKÁLNÍ GRAF
$chart2 = new VerticalChart(600400);

foreach (
$Arr AS $k => $v)
{
    
$chart2->addPoint(new Point($k$v));
}
$chart2->setTitle('Verikální graf');
$chart2->setLabelMarginLeft(80);
$chart2->render('vertical-chart.png');

// KRUHOVÝ GRAF
$chart3 = new PieChart(600300);

foreach (
$Arr AS $k => $v)
{
    
$chart3->addPoint(new Point($k$v));
}
$chart3->setTitle('Kruhový graf');
//$chart3->setMargin(50);
$chart3->render('pie-chart.png');
?>