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

Zones Dash Style doesn't work #38

Closed opaniagu closed 8 years ago

opaniagu commented 8 years ago

I try to define Zone with dash style, but chart is not render:

http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/series/color-zones-dashstyle-dot/

Please help.

echo Highcharts::widget([
   'options' => [
      'title' => ['text' => 'Fruit Consumption'],
      'xAxis' => [
        'categories' => ['Dic','Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
      ],
      'yAxis' => [
         'title' => ['text' => 'Fruit eaten']
      ],
      'series' => [
         [
            'name' => 'Jane', 
            'data' => [1, 0, 4, 2, 1, 1, 1, 1 ,2, 3],

            'zoneAxis'=> 'x',

            'zones' => [
                    'value' => 2,
                    'dashStyle' => 'dot'
            ],

        ],
        ['name' => 'John', 'data' => [5, 7, 3]]
      ]
   ]
]);
miloschuman commented 8 years ago

You are missing a set of brackets around the 'zones' value. Here is a working solution:

echo Highcharts::widget([
    'options' => [
        'title' => ['text' => 'Fruit Consumption'],
        'xAxis' => [
            'categories' => ['Dic', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        ],
        'yAxis' => [
            'title' => ['text' => 'Fruit eaten']
        ],
        'series' => [
            [
                'name' => 'Jane',
                'data' => [1, 0, 4, 2, 1, 1, 1, 1, 2, 3],
                'zoneAxis' => 'x',
                'zones' => [
                    [
                        'value' => 2,
                        'dashStyle' => 'dot'
                    ]
                ],
            ],
            ['name' => 'John', 'data' => [5, 7, 3]]
        ]
    ]
]);