Ejemplo n.º 1
1
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = chart_budget_report();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$budget = new \Kendo\Dataviz\UI\ChartSeriesItem();
$budget->field('budget');
$spending = new \Kendo\Dataviz\UI\ChartSeriesItem();
$spending->field('spending');
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('unit');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('template' => '$#= value / 1000 #k'));
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'remote-data-binding.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport);
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Budget report'))->dataSource($dataSource)->addSeriesItem($budget, $spending)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'radarLine', 'style' => 'smooth'));
echo $chart->render();
require_once '../include/footer.php';
Ejemplo n.º 2
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = chart_stock_prices();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\ChartSeriesItem();
$series->type('line')->field('close')->name('#= group.value # (close)');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('format' => '${0}', 'skip' => 2, 'step' => 2));
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('date')->labels(array('format' => 'MMM'));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('{0}%')->template('#= series.name # - #= value #%');
$model = new \Kendo\Data\DataSourceSchemaModel();
$model->addField(array('field' => 'date', 'type' => 'date'));
$schema = new \Kendo\Data\DataSourceSchema();
$schema->model($model);
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'grouped-data.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->addGroupItem(array('field' => 'symbol'))->addSortItem(array('field' => 'date', 'dir' => 'asc'));
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Stock Prices'))->dataSource($dataSource)->legend(array('position' => 'bottom'))->addSeriesItem($series)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'area'))->tooltip($tooltip);
echo $chart->render();
require_once '../include/footer.php';
Ejemplo n.º 3
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\ChartSeriesItem();
$series->field('value')->colorField('userColor');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->max(28)->majorGridLines(array('visible' => false))->visible(false);
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('day')->majorGridLines(array('visible' => false))->line(array('visible' => false));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('{0}%')->template('#= category # - #= value #%');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->data(chart_blog_comments());
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('align' => 'left', 'text' => 'Comments per day'))->dataSource($dataSource)->legend(array('visible' => false))->addSeriesItem($series)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'column', 'labels' => array('visible' => true, 'background' => 'transparent')))->tooltip($tooltip);
echo $chart->render();
require_once '../include/footer.php';
Ejemplo n.º 4
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\ChartSeriesItem();
$series->field('value')->name('United States');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('format' => '{0}%'))->line(array('visible' => false));
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('year')->majorGridLines(array('visible' => false));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('{0}%')->template('#= category # - #= value #%');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->data(chart_united_states_internet_usage());
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Internet Users in United States'))->dataSource($dataSource)->legend(array('visible' => false))->addSeriesItem($series)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'area', 'labels' => array('visible' => true, 'format' => '{0}%', 'background' => 'transparent')))->tooltip($tooltip);
echo $chart->render();
require_once '../include/footer.php';
Ejemplo n.º 5
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = chart_spain_electricity_production();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$nuclear = new \Kendo\Dataviz\UI\ChartSeriesItem();
$nuclear->field('nuclear')->name('Nuclear');
$hydro = new \Kendo\Dataviz\UI\ChartSeriesItem();
$hydro->field('hydro')->name('Hydro');
$wind = new \Kendo\Dataviz\UI\ChartSeriesItem();
$wind->field('wind')->name('Wind');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('format' => 'N0'))->line(array('visible' => false))->majorUnit(10000);
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('year')->labels(array('rotation' => -90))->crosshair(array('visible' => true));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('N0')->shared(true);
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'remote-data-binding.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->addSortItem(array('field' => 'year', 'dir' => 'asc'));
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Spain electricity production (GWh)'))->dataSource($dataSource)->legend(array('position' => 'top'))->addSeriesItem($nuclear, $hydro, $wind)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'line'))->tooltip($tooltip);
echo $chart->render();
require_once '../include/footer.php';
Ejemplo n.º 6
0
    header('Content-Type: application/json');
    $result = chart_spain_electricity_production();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$nuclear = new \Kendo\Dataviz\UI\ChartSeriesItem();
$nuclear->field('nuclear')->name('Nuclear');
$hydro = new \Kendo\Dataviz\UI\ChartSeriesItem();
$hydro->field('hydro')->name('Hydro');
$wind = new \Kendo\Dataviz\UI\ChartSeriesItem();
$wind->field('wind')->name('Wind');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('format' => 'N0'))->line(array('visible' => false))->majorUnit(10000);
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('year')->labels(array('rotation' => -90));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('N0');
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'events.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->addSortItem(array('field' => 'year', 'dir' => 'asc'));
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Spain electricity production (GWh)'))->dataSource($dataSource)->legend(array('position' => 'top'))->addSeriesItem($nuclear, $hydro, $wind)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'column'))->tooltip($tooltip)->seriesClick('onSeriesClick')->seriesHover('onSeriesHover')->dataBound('onDataBound')->axisLabelClick('onAxisLabelClick')->plotAreaClick('onPlotAreaClick')->dragStart('onDragStart')->drag('onDrag')->dragEnd('onDragEnd')->zoomStart('onZoomStart')->zoom('onZoom')->zoomEnd('onZoomEnd');
echo $chart->render();
?>
<div class="demo-section">
    <h3 class="title">Console log</h3>
    <div class="console"></div>
</div>
Ejemplo n.º 7
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
require_once '../include/header.php';
$proteins = new \Kendo\Dataviz\UI\ChartSeriesItem();
$proteins->name('Proteins')->type('radarColumn')->field('score');
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('abbr');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->visible(false);
$dataSource = new \Kendo\Data\DataSource();
$dataSource->data(chart_protein_data());
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Protein quality, Apple raw'))->dataSource($dataSource)->addSeriesItem($proteins)->addCategoryAxisItem($categoryAxis)->addValueAxisItem($valueAxis)->tooltip(array('visible' => true))->legend(array('visible' => false));
echo $chart->render();
require_once '../include/footer.php';
Ejemplo n.º 8
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = chart_wind_data();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$frequency = new \Kendo\Dataviz\UI\ChartSeriesItem();
$frequency->type('radarColumn')->stack(true)->field('frequency');
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('dirText');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->visible(false);
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'grouped-data.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->addGroupItem(array('field' => 'category'))->addSortItem(array('field' => 'dir', 'dir' => 'asc'));
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Wind Rose'))->legend(array('position' => 'right', 'labels' => array('template' => '#= (series.data[0] || {}).categoryText # m/s')))->dataSource($dataSource)->seriesColors(array('#1b79e4', '#3b6ad3', '#5d5ac2', '#8348ae', '#a23a9d', '#c42a8c', '#e51a7a'))->addSeriesItem($frequency)->addCategoryAxisItem($categoryAxis)->addValueAxisItem($valueAxis)->tooltip(array('template' => '#= category # (#= dataItem.categoryText # m/s) #= value #%', 'visible' => true));
echo $chart->render();
require_once '../include/footer.php';
Ejemplo n.º 9
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = chart_stock_prices();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\ChartSeriesItem();
$series->type('area')->field('close')->name('#= group.value # (close)');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('format' => 'N0', 'skip' => 2, 'step' => 2))->line(array('visible' => false))->max(700);
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('date')->labels(array('format' => 'MMM'))->line(array('visible' => false))->majorGridLines(array('visible' => false));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('{0}%')->template('#= series.name # - #= value #%');
$model = new \Kendo\Data\DataSourceSchemaModel();
$model->addField(array('field' => 'date', 'type' => 'date'));
$schema = new \Kendo\Data\DataSourceSchema();
$schema->model($model);
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'grouped-data.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->addGroupItem(array('field' => 'symbol'))->addSortItem(array('field' => 'date', 'dir' => 'asc'));
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Stock Prices'))->dataSource($dataSource)->legend(array('position' => 'bottom'))->addSeriesItem($series)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'area'))->tooltip($tooltip);
echo $chart->render();
require_once '../include/footer.php';