示例#1
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$total = new \Kendo\Dataviz\UI\ChartSeriesItem();
$total->name('Total Visits')->data(array(56000, 63000, 74000, 91000, 117000, 138000));
$unique = new \Kendo\Dataviz\UI\ChartSeriesItem();
$unique->name('Unique visitors')->data(array(52000, 34000, 23000, 48000, 67000, 83000));
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->line(array('visible' => false));
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->categories(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'))->majorGridLines(array('visible' => false));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->template('#= series.name #: #= value #');
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->addSeriesItem($total, $unique)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->legend(array('position' => 'bottom'))->seriesDefaults(array('type' => 'column'))->chartArea(array('background' => 'transparent'))->title(array('text' => 'Site Visitors Stats /thousands/'))->tooltip($tooltip);
echo $chart->render();
?>
<div class="configuration-horizontal">
    <div class="config-section">
        <span class="configHead">Gap</span>
        <ul class="options">
            <li>
                <input id="gap" type="number" value="1.5" step="0.1" style="width: 60px;" />
                <button id="getGap" class="k-button">Set gap</button
            </li>
        </ul>
    </div>
    <div class="config-section">
        <span class="configHead">Spacing</span>
        <ul class="options">
示例#2
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$gold = new \Kendo\Dataviz\UI\ChartSeriesItem();
$gold->name('Gold Medals')->data(array(40, 32, 34, 36, 45, 33, 34, 83, 36, 37, 44, 37, 35, 36, 46))->color('#f3ac32');
$silver = new \Kendo\Dataviz\UI\ChartSeriesItem();
$silver->name('Silver Medals')->data(array(19, 25, 21, 26, 28, 31, 35, 60, 31, 34, 32, 24, 40, 38, 29))->color('#b8b8b8');
$bronze = new \Kendo\Dataviz\UI\ChartSeriesItem();
$bronze->name('Bronze Medals')->data(array(17, 17, 16, 28, 34, 30, 25, 30, 27, 37, 25, 33, 26, 36, 29))->color('#bb6e36');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->line(array('visible' => false))->majorGridLines(array('visible' => true));
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->categories(array(1952, 1956, 1960, 1964, 1968, 1972, 1976, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012))->majorGridLines(array('visible' => false));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->template('#= series.name #: #= value #');
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Olympic Medals won by USA'))->legend(array('visible' => false))->addSeriesItem($gold, $silver, $bronze)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->tooltip($tooltip)->seriesDefaults(array('type' => 'bar', 'stack' => array('type' => '100%')));
echo $chart->render();
?>

<?php 
require_once '../include/footer.php';