Example #1
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$maxTemperature = new \Kendo\Dataviz\UI\ChartSeriesItem();
$maxTemperature->type('line')->data(array(6, 10, 10, 10, 10, 9, 5, 5, 10, 8, 8, 5, 8, 11, 9, 15, 20, 23, 24, 21, 21, 20, 22, 22, 20, 18, 16, 15, 20, 13.2, 18))->name('Max. Temperature [&deg;C]')->color('#ff1c1c')->axis('temp');
$minTemperature = new \Kendo\Dataviz\UI\ChartSeriesItem();
$minTemperature->type('line')->data(array(-5, -6, 0, -4, -3, -5.2, -5, -1.7, -1, 0, -0.4, -2, -2, -5, 4, -2, -4, -1, -1, 2, 4, -1, 1, 1, 4, 0, -1, 1, -2, 5.7, 5))->name('Min. Temperature [&deg;C]')->color('#ffae00')->axis('temp');
$windSpeed = new \Kendo\Dataviz\UI\ChartSeriesItem();
$windSpeed->type('area')->data(array(16.4, 21.7, 35.4, 19, 10.9, 13.6, 10.9, 10.9, 10.9, 16.4, 16.4, 13.6, 13.6, 29.9, 27.1, 16.4, 13.6, 10.9, 16.4, 10.9, 24.5, 10.9, 8.1, 19, 21.7, 27.1, 24.5, 16.4, 27.1, 29.9, 27.1))->name('Wind Speed [km/h]')->color('#73c100')->axis('wind');
$rainfall = new \Kendo\Dataviz\UI\ChartSeriesItem();
$rainfall->type('area')->data(array(5.4, 2, 5.4, 3, 2, 1, 3.2, 7.4, 0, 8.199999999999999, 0, 1.8, 0.3, 0, 0, 2.3, 0, 3.7, 5.2, 6.5, 0, 7.1, 0, 4.7, 0, 1.8, 0, 0, 0, 1.5, 0.8))->name('Rainfall [mm]')->color('#007eff')->axis('rain');
$rainValueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$rainValueAxis->name('rain')->color('#007eff')->min(0)->max(60);
$windValueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$windValueAxis->name('wind')->color('#73c100')->min(0)->max(60);
$tempValueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$tempValueAxis->name('temp')->min(-30)->max(30);
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->categories(array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31'))->axisCrossingValue(array(32, 32, 0))->justified(true);
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('{0}')->template('#= category #/03: #= value #');
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'March Weather Report'))->legend(array('position' => 'bottom'))->addSeriesItem($maxTemperature, $minTemperature, $windSpeed, $rainfall)->addValueAxisItem($rainValueAxis, $windValueAxis, $tempValueAxis)->addCategoryAxisItem($categoryAxis)->tooltip($tooltip)->seriesDefaults(array('type' => 'line'));
echo $chart->render();
require_once '../include/footer.php';
Example #2
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$battery = new \Kendo\Dataviz\UI\ChartSeriesItem();
$battery->type('column')->data(array(20, 40, 45, 30, 50))->stack(true)->name('on battery')->color('#cc6e38');
$gas = new \Kendo\Dataviz\UI\ChartSeriesItem();
$gas->type('column')->data(array(20, 30, 35, 35, 40))->stack(true)->name('on gas')->color('#ef955f');
$mpg = new \Kendo\Dataviz\UI\ChartSeriesItem();
$mpg->type('line')->data(array(30, 38, 40, 32, 42))->name('mpg')->color('#ec5e0a')->axis('mpg');
$l100km = new \Kendo\Dataviz\UI\ChartSeriesItem();
$l100km->type('line')->data(array(7.8, 6.2, 5.9, 7.4, 5.6))->name('l/100 km')->color('#4e4141')->axis('l100km');
$milesAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$milesAxis->title(array('text' => 'miles'))->min(0)->max(100);
$kmAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$kmAxis->name('km')->title(array('text' => 'km'))->min(0)->max(161)->majorUnit(32);
$mpgAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$mpgAxis->name('mpg')->title(array('text' => 'miles per gallo'))->color('#642381');
$l100kmAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$l100kmAxis->name('l100km')->title(array('text' => 'liters per 100km'))->color('#e5388a');
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->categories(array('Mon', 'Tue', 'Wed', 'Thu', 'Fri'))->axisCrossingValue(array(0, 0, 10, 10));
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Hybrid car mileage report'))->legend(array('position' => 'top'))->addSeriesItem($battery, $gas, $mpg, $l100km)->addValueAxisItem($milesAxis, $kmAxis, $mpgAxis, $l100kmAxis)->addCategoryAxisItem($categoryAxis);
echo $chart->render();
require_once '../include/footer.php';