yii2-highcharts-widget

Add function in widget.

For rendering 3d chart add lines to file Highcharts.php:

  • after (86 line)

protected $baseScript = 'highcharts';

add


protected $extendScript = 'highcharts-3d';

  • after (116 line)

array_unshift($this->scripts, $this->baseScript);

add


array_push($this->scripts, $this->extendScript);

Demo code




echo \miloschuman\highcharts\Highcharts::widget([

    'options' => [

        'chart' => [

            'type' => 'column',

            'margin' => 75,

            'options3d' => [

                'enabled' => true,

                'alpha' => 10,

                'beta' => 25,

                'depth' => 70,

                'viewDistance' => 25

            ],

        ],

        'title' => ['text' => 'Fruit Consumption'],

        'plotOptions' => ['column' => ['depth' => 25]],

        'xAxis' => [

            'categories' => 'Highcharts.getOptions().lang.shortMonths'

        ],

        'yAxis' => [

            'opposite' => true

        ],

        'series' => [

            ['name' => 'Sales', 'data' => [2, 3, null, 4, 0, 5, 1, 4, 6, 3]],

        ]

    ]

]);