Beispiel #1
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\StockChartSeriesItem();
$series->type('candlestick')->openField('Open')->highField('High')->lowField('Low')->closeField('Close');
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => '_intraday.php', 'type' => 'POST', 'dataType' => 'json'))->parameterMap('function(data) {
              return kendo.stringify(data);
          }');
$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)->serverFiltering(true);
$navigator = new \Kendo\Dataviz\UI\StockChartNavigator();
$navigator->addSeriesItem(array('type' => 'area', 'field' => 'Close'))->dataSource($dataSource)->select(array('from' => '2009/02/05', 'to' => '2011/10/07'));
$chart = new \Kendo\Dataviz\UI\StockChart('stock-chart');
$chart->dataSource($dataSource)->title(array('text' => 'The ACME Company'))->dateField('Date')->addSeriesItem($series)->navigator($navigator);
echo $chart->render();
require_once '../include/footer.php';
Beispiel #2
0
<?php

require_once '../lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = json_decode(file_get_contents('../content/dataviz/js/boeing-stock.json'));
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$stock = new \Kendo\Dataviz\UI\StockChartSeriesItem();
$stock->type('candlestick')->openField('Open')->highField('High')->lowField('Low')->closeField('Close');
$volume = new \Kendo\Dataviz\UI\StockChartSeriesItem();
$volume->type('column')->field('Volume')->axis('volumeAxis')->tooltip(array('format' => '{0:C0}'));
$navigator = new \Kendo\Dataviz\UI\StockChartNavigator();
$navigator->addSeriesItem(array('type' => 'area', 'field' => 'Close'))->select(array('from' => '2009/02/05', 'to' => '2011/10/07'));
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'panes.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport);
$chart = new \Kendo\Dataviz\UI\StockChart('stock-chart');
$chart->dataSource($dataSource)->title(array('text' => 'The Boeing Company (NYSE:BA)'))->dateField('Date')->addPane(array('title' => 'Value'), array('name' => 'volumePane', 'title' => 'Volume', 'height' => 150))->addCategoryAxisItem(array('pane' => 'volumePane'))->addValueAxisItem(array('line' => array('visible' => false)), array('name' => 'volumeAxis', 'pane' => 'volumePane', 'visible' => false))->addSeriesItem($stock, $volume)->navigator($navigator);
echo $chart->render();
?>
<style scoped>
.k-chart {
    height: 500px;
}
</style>
<?php 
require_once '../include/footer.php';
Beispiel #3
0
<?php

require_once '../lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = json_decode(file_get_contents('../content/dataviz/js/boeing-stock.json'));
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\StockChartSeriesItem();
$series->type('candlestick')->openField('Open')->highField('High')->lowField('Low')->closeField('Close');
$navigator = new \Kendo\Dataviz\UI\StockChartNavigator();
$navigator->addSeriesItem(array('type' => 'area', 'field' => 'Close'))->select(array('from' => '2009/02/05', 'to' => '2011/10/07'));
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->notes(array('data' => array(array('value' => '2001/01/01', 'label' => array('text' => '01')), array('value' => '2002/01/01', 'label' => array('text' => '02')), array('value' => '2003/01/01', 'label' => array('text' => '03')), array('value' => '2004/01/01', 'label' => array('text' => '04')), array('value' => '2005/01/01', 'label' => array('text' => '05')), array('value' => '2006/01/01', 'label' => array('text' => '06')), array('value' => '2007/01/01', 'label' => array('text' => '07')), array('value' => '2008/01/01', 'label' => array('text' => '08')), array('value' => '2009/01/01', 'label' => array('text' => '09')), array('value' => '2010/01/01', 'label' => array('text' => '10')), array('value' => '2011/01/01', 'label' => array('text' => '11')), array('value' => '2012/01/01', 'label' => array('text' => '12')))));
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'index.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport);
$chart = new \Kendo\Dataviz\UI\StockChart('stock-chart');
$chart->dataSource($dataSource)->title(array('text' => 'The Boeing Company (NYSE:BA)'))->dateField('Date')->addSeriesItem($series)->addCategoryAxisItem($categoryAxis)->navigator($navigator);
echo $chart->render();
require_once '../include/footer.php';