<?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->xField('price')->yField('performance'); $dataSource = new \Kendo\Data\DataSource(); $dataSource->data(chart_price_performance()); $chart = new \Kendo\Dataviz\UI\Chart('chart'); $chart->title(array('text' => 'Price-Performance Ratio'))->dataSource($dataSource)->addSeriesItem($series)->tooltip(array('visible' => true, 'template' => "#= '<b>\$' + value.x + ' / ' + dataItem.family + ' ' + dataItem.model + ': ' + value.y + '%</b>' #"))->addXAxisItem(array('max' => 1000, 'labels' => array('format' => '${0}'), 'title' => array('text' => 'Price')))->addYAxisItem(array('min' => 80, 'labels' => array('format' => '{0}%'), 'title' => array('text' => 'Performance Ratio')))->legend(array('visible' => false))->seriesDefaults(array('type' => 'scatter')); echo $chart->render(); require_once '../include/footer.php';
<?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->xField('date')->yField('close'); $transport = new \Kendo\Data\DataSourceTransport(); $transport->read(array('url' => 'date-axis.php', 'type' => 'POST', 'dataType' => 'json')); $model = new \Kendo\Data\DataSourceSchemaModel(); $model->addField(array('field' => 'date', 'type' => 'date')); $schema = new \Kendo\Data\DataSourceSchema(); $schema->model($model); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->schema($schema)->addSortItem(array('field' => 'date', 'dir' => 'asc'))->addGroupItem(array('field' => 'symbol')); $chart = new \Kendo\Dataviz\UI\Chart('chart'); $chart->title(array('text' => 'Closing stock prices'))->dataSource($dataSource)->addSeriesItem($series)->tooltip(array('visible' => true, 'template' => '{0:d}, ${1}'))->addYAxisItem(array('labels' => array('format' => '${0}', 'skip' => 1)))->seriesDefaults(array('type' => 'scatterLine', 'markers' => array('size' => 6))); echo $chart->render(); require_once '../include/footer.php';