See also: Highcharts
Inheritance: extends Highcharts
Example #1
0
/*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' => [
    //    'height' => 400,
    //    'width' => 400
    //],
    'data' => [
    [
        'value'=> '300',
Example #2
0
use yii\helpers\Url;
?>

    <div class="dropdown">
        <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
            <?php 
echo $yearSelected;
?>
            <span class="caret"></span>
        </button>
        <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
            <?php 
foreach ($possibleYears as $year) {
    ?>
                <li><a href="<?php 
    echo Url::current(['filter_region' => $year]);
    ?>
"><?php 
    echo $year;
    ?>
</a></li>
            <?php 
}
?>

        </ul>
    </div>

<?php 
echo Highmaps::widget(['options' => ['title' => ['text' => 'Highmaps basic demo'], 'mapNavigation' => ['enabled' => true, 'buttonOptions' => ['verticalAlign' => 'bottom']], 'colorAxis' => ['min' => 0], 'series' => [['data' => $data, 'mapData' => new JsExpression('Highcharts.maps["countries/kz/kz-all"]'), 'joinBy' => 'hc-key', 'name' => 'Unemployment Adult for 2001 year', 'states' => ['hover' => ['color' => '#BADA55']], 'dataLabels' => ['enabled' => true, 'format' => '{point.name}']]]]]);
echo Highcharts::widget(['options' => ['title' => ['text' => 'Fruit Consumption'], 'xAxis' => ['categories' => $possibleYears], 'yAxis' => ['title' => ['text' => 'Fruit eaten']], 'series' => $dataChart]]);
Example #3
0
    <?php 
echo Breadcrumbs::widget(['itemTemplate' => "<li><i>{link}</i></li>\n", 'links' => [['label' => '首页']]]);
?>
    <?php 
//获得访问来源
$search_date = '2016-02-26';
$pieComeFrom = NginxHightchartService::getPieHightChart('2016-02-26', "TopType=:topT", [':topT' => 'user_ip_1'], 'DetailType1', NginxHightchartService::AccessStatisticOne, true);
$data = [];
$cityMap = \Yii::$app->params['cityMap'];
foreach ($pieComeFrom['in_country']['series']['data'] as $key => $dataValue) {
    $data[] = ['hc-key' => $cityMap[$dataValue['name']], 'value' => $dataValue['y'], ['url' => $dataValue['url']]];
}
?>
    <div class="body-content">
        <div class="panel panel-default">
            <?php 
echo $this->render('common_top.php', ['url' => '/visit/servicestatus']);
?>
            <div class="panel-body">
                <div class="tab-content">
                    <div class="tab-pane active">
                        <?php 
echo Highmaps::widget(['options' => ['chart' => ['height' => 500], 'mapNavigation' => ['enabled' => true], 'title' => ['text' => '全国访问量'], 'colorAxis' => ['min' => 0, 'minColor' => '#E6E7E8', 'maxColor' => '#FF0000'], 'plotOptions' => ['series' => ['point' => ['events' => ['click' => new JsExpression("function(e){window.open('/nginx/city.html?pinyin='+this.name+'&date=" . $search_date . "')}")]]]], 'subtitle' => ['text' => '中国', 'floating' => TRUE, 'align' => 'right', 'y' => 50], 'series' => [['name' => '省份', 'mapData' => new JsExpression('Highcharts.maps["countries/cn/custom/cn-all-sar-taiwan"]'), 'joinBy' => 'hc-key', 'data' => $data, 'dataLabels' => ['enabled' => true, 'crop' => false, 'overflow' => 'none', 'format' => '{point.properties.cn-name}']]], 'credits' => ['text' => '大学霸', 'href' => 'http://daxueba.net']]]);
?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>