miloschuman / yii2-highcharts

Highcharts widget for Yii 2 Framework
http://www.yiiframework.com/extension/yii2-highcharts-widget/
MIT License
166 stars 63 forks source link

How we can change the color of Area Spline #71

Open pawansgi92 opened 6 years ago

pawansgi92 commented 6 years ago

I want to change the color of this graph. Can anyone suggest how can i do this

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([ // The highcharts initialization statement will be wrapped in a function // named 'mycallbackFunction' with one parameter: data. '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'), // Here we use the callback parameter, 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")')] ] ] ] ] ] ]);