См. также: Highcharts
Наследование: extends Highcharts
Пример #1
1
        'series' => [
            [
                'type' => 'candlestick',
                'name' => 'OHLC',
                // just like before, only now the columns are referenced by array offset
                'data' => new SeriesDataHelper($data, ['0:timestamp', 1, 2, 3, 4]),
            ],
            [
                'type' => 'column',
                'name' => 'Volume',
                'data' => new SeriesDataHelper($data, ['0:timestamp', '5:int']),
                'yAxis' => 1,
            ],
        ]
    ]
]);*/
use miloschuman\highcharts\Highstock;
use miloschuman\highcharts\SeriesDataHelper;
// back to the original data from the first example
$data = [['date' => '2006-05-14T20:00:00-0400', 'open' => 67.37, 'high' => 68.38, 'low' => 67.12, 'close' => 67.79000000000001, 'volume' => 18921051], ['date' => '2006-05-15T20:00:00-0400', 'open' => 68.09999999999999, 'high' => 68.25, 'low' => 64.75, 'close' => 64.98, 'volume' => 33470860], ['date' => '2006-05-16T20:00:00-0400', 'open' => 64.7, 'high' => 65.7, 'low' => 64.06999999999999, 'close' => 65.26000000000001, 'volume' => 26941146], ['date' => '2006-05-17T20:00:00-0400', 'open' => 65.68000000000001, 'high' => 66.26000000000001, 'low' => 63.12, 'close' => 63.18, 'volume' => 23524811], ['date' => '2006-05-18T20:00:00-0400', 'open' => 63.26, 'high' => 64.88, 'low' => 62.82, 'close' => 64.51000000000001, 'volume' => 35221586], ['date' => '2006-05-21T20:00:00-0400', 'open' => 63.87, 'high' => 63.99, 'low' => 62.77, 'close' => 63.38, 'volume' => 25680800], ['date' => '2006-05-22T20:00:00-0400', 'open' => 64.86, 'high' => 65.19, 'low' => 63, 'close' => 63.15, 'volume' => 24814061], ['date' => '2006-05-23T20:00:00-0400', 'open' => 62.99, 'high' => 63.65, 'low' => 61.56, 'close' => 63.34, 'volume' => 32722949], ['date' => '2006-05-24T20:00:00-0400', 'open' => 64.26000000000001, 'high' => 64.45, 'low' => 63.29, 'close' => 64.33, 'volume' => 16563319], ['date' => '2006-05-25T20:00:00-0400', 'open' => 64.31, 'high' => 64.56, 'low' => 63.14, 'close' => 63.55, 'volume' => 15464811]];
function myUnnecessaryFloorCallback($val)
{
    if (true) {
        return floor($val);
    } else {
        die('I am Bender. Please insert girder.');
    }
}
echo Highstock::widget(['options' => ['title' => ['text' => 'Oy vey! This chart again?!'], 'yAxis' => [['title' => ['text' => 'OHLC'], 'height' => '60%'], ['title' => ['text' => 'Volume'], 'top' => '65%', 'height' => '35%', 'offset' => 0]], 'series' => [['type' => 'candlestick', 'name' => 'OHLC', 'data' => new SeriesDataHelper($data, ['date:datetime', 'open:floor', ['high', 'floor'], ['low', function ($val) {
    return floor($val);
}], 'close:myUnnecessaryFloorCallback'])], ['type' => 'column', 'name' => 'Volume', 'data' => new SeriesDataHelper($data, [['date', 'datetime'], ['volume', 'myUnnecessaryFloorCallback']]), 'yAxis' => 1]]]]);
Пример #2
0
        ],
      "yAxis"=> [
         "title"=> [ "text"=> "Значение" ]
      ],
      'series' => [

         [   'type' => 'line',
             "name"=>"Температура",
             "data" =>   new SeriesDataHelper($dataProvider, ['date:datetime', 'temp:float']),

         ]
      ]
   ]
]); */
echo Highstock::widget(['options' => ['chart' => ['zoomType' => 'x'], 'rangeSelector' => ['selected' => 5, 'buttons' => [['type' => 'minute', 'count' => 720, 'text' => '12ч'], ['type' => 'month', 'count' => 1, 'text' => '1мес'], ['type' => 'month', 'count' => 3, 'text' => '3мес'], ['type' => 'month', 'count' => 6, 'text' => '6мес'], ['type' => 'month', 'count' => 12, 'text' => '1год'], ['type' => 'All', 'text' => 'Всё']]], 'tooltip' => ['crosshaits' => 'true', 'shared' => 'true', 'valueSuffix' => '°C'], 'title' => ['text' => 'График изменений темературы'], 'subtitle' => ['text' => 'Выделите область для приблежения графика'], 'series' => [['name' => 'Температура', 'data' => $isData ? new SeriesDataHelper($dataProvider, ['date:datetime', 'temp:float']) : [0, 0.0], 'type' => 'line', 'threshold' => null, 'color' => 'red']]]]);
echo Highstock::widget(['options' => ['chart' => ['zoomType' => 'x'], 'rangeSelector' => ['selected' => 5, 'buttons' => [['type' => 'minute', 'count' => 720, 'text' => '12ч'], ['type' => 'month', 'count' => 1, 'text' => '1мес'], ['type' => 'month', 'count' => 3, 'text' => '3мес'], ['type' => 'month', 'count' => 6, 'text' => '6мес'], ['type' => 'month', 'count' => 12, 'text' => '1год'], ['type' => 'All', 'text' => 'Всё']]], 'tooltip' => ['crosshaits' => 'true', 'shared' => 'true', 'valueSuffix' => 'BPM'], 'title' => ['text' => 'График изменений пульса'], 'subtitle' => ['text' => 'Выделите область для приблежения графика'], 'series' => [['name' => 'Пульс', 'data' => $isData ? new SeriesDataHelper($dataProvider, ['date:datetime', 'pulseAvg:int']) : [0, 0], 'type' => 'line', 'threshold' => null, 'color' => 'black']]]]);
$id = 1;
?>
<div  id="getDataForm" style="text-align: center;">
    <div class="form-group">
    <?php 
echo Html::beginForm(['/admin/charts', 'id' => 'charts'], 'POST', ['enctype' => 'multipart/form-data', 'class' => "form-inline"]);
?>
    <?php 
echo Html::label('Период с:', 'startDatePeriod');
?>
    <?php 
echo Html::input('text', 'startDatePeriod', $start, ['class' => 'form-control']);
?>
    <?php 
echo Html::label('по:', 'endDatePeriod');
Пример #3
0
//use miloschuman\highcharts\Highcharts;
//use yii\web\JsExpression;
use backend\assets\AppAsset;
/* CLASS ASSET CSS/JS/THEME Author: -ptr.nov-*/
AppAsset::register($this);
/* INDEPENDENT CSS/JS/THEME FOR PAGE  Author: -ptr.nov-*/
/*Title page Modul*/
$this->sideMenu = 'hrd';
$this->title = Yii::t('app', 'Dashboard');
$this->params['breadcrumbs'][] = $this->title;
use miloschuman\highcharts\Highcharts;
echo Highcharts::widget(['options' => ['title' => ['text' => 'Fruit Consumption'], 'xAxis' => ['categories' => ['Apples', 'Bananas', 'Oranges']], 'yAxis' => ['title' => ['text' => 'Fruit eaten']], 'series' => [['name' => 'Jane', 'data' => [1, 0, 4]], ['name' => 'John', 'data' => [5, 7, 3]]]]]);
use miloschuman\highcharts\Highstock;
use yii\web\JsExpression;
$this->registerJs('$.getJSON("//www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?", myCallbackFunction);');
echo Highstock::widget(['callback' => 'myCallbackFunction', 'options' => ['rangeSelector' => ['inputEnabled' => new JsExpression('$("#container").width() > 480'), 'selected' => 1], 'title' => ['text' => 'AAPL Stock Price'], 'series' => [['name' => 'AAPL Stock Price', 'data' => new JsExpression('data'), 'type' => 'areaspline', 'threshold' => null, 'tooltip' => ['valueDecimals' => 2], 'fillColor' => ['linearGradient' => ['x1' => 0, 'y1' => 0, 'x2' => 0, 'y2' => 1], 'stops' => [[0, new JsExpression('Highcharts.getOptions().colors[0]')], [1, new JsExpression('Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0).get("rgba")')]]]]]]]);
use miloschuman\highcharts\Highmaps;
//use yii\web\JsExpression;
// To use Highcharts Map Collection, we must register those files separately.
// The 'depends' option ensures that the main Highmaps script gets loaded first.
$this->registerJsFile('http://code.highcharts.com/mapdata/countries/de/de-all.js', ['depends' => 'miloschuman\\highcharts\\HighchartsAsset']);
echo Highmaps::widget(['options' => ['title' => ['text' => 'Highmaps basic demo'], 'mapNavigation' => ['enabled' => true, 'buttonOptions' => ['verticalAlign' => 'bottom']], 'colorAxis' => ['min' => 0], 'series' => [['data' => [['hc-key' => 'de-ni', 'value' => 0], ['hc-key' => 'de-hb', 'value' => 1], ['hc-key' => 'de-sh', 'value' => 2], ['hc-key' => 'de-be', 'value' => 3], ['hc-key' => 'de-mv', 'value' => 4], ['hc-key' => 'de-hh', 'value' => 5], ['hc-key' => 'de-rp', 'value' => 6], ['hc-key' => 'de-sl', 'value' => 7], ['hc-key' => 'de-by', 'value' => 8], ['hc-key' => 'de-th', 'value' => 9], ['hc-key' => 'de-st', 'value' => 10], ['hc-key' => 'de-sn', 'value' => 11], ['hc-key' => 'de-br', 'value' => 12], ['hc-key' => 'de-nw', 'value' => 13], ['hc-key' => 'de-bw', 'value' => 14], ['hc-key' => 'de-he', 'value' => 15]], 'mapData' => new JsExpression('Highcharts.maps["countries/de/de-all"]'), 'joinBy' => 'hc-key', 'name' => 'Random data', 'states' => ['hover' => ['color' => '#BADA55']], 'dataLabels' => ['enabled' => true, 'format' => '{point.name}']]]]]);
use dosamigos\chartjs\ChartJs;
?>


<?

 $coba = ChartJs::widget([
    'type' => 'Pie',
    //'options' => [