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

'pareto' type not recongnize, error 17 #73

Closed Erebril closed 5 years ago

Erebril commented 5 years ago

Hi,

i'm trying to replicate the pareto chart example from the highcharts examples. but always get an error 17. im' using the last version of yii2-highcharts (7.0) and pareto type is added in highcharts version 6. is this a bug? or i made a mistake?

this is my code

Highcharts::widget([
'scripts' => [
        'modules/exporting',
        'modules/export-data',
        'themes/grid-light',
      ],
      'options' => [
        'credits' => [
          'enabled' => false
        ],
        'lang' => [
          'contextButtonTitle' => 'Menú contextual',
          'printChart' => 'Imprimir gráfico',
          'decimalPoint' => ',',
          'downloadPDF' => 'Descargar documento PDF',
          'downloadPNG' => 'Descargar imagen PNG',
          'downloadXLS' => 'Descargar archivo Excel'
        ],
        'chart' => [
          'type' => 'column',
        ],
        'title' => [
          'text' => 'Diagrama de Pareto',
        ],
        'subtitle' => [
          'text' => '',
        ],
        'tooltip' => [
          'shared' => true
        ],
        'xAxis' => [
          'categories' => [
            'Overpriced',
            'Small portions',
            'Wait time',
            'Food is tasteless',
            'No atmosphere',
            'Not clean',
            'Too noisy',
            'Unfriendly staff'
        ],
          'crosshair' => true,
        ],
        'yAxis' => [
          [
            'title' => [ 'text' => ''],
          ],
          [
            'title' => [ 'text' => ''],
            'minPadding' => 0,
            'maxPadding' => 0,
            'max' => 100,
            'min' => 0,
            'opposite' => true,
            'labels' => [
              'format' => "{value}%"
            ],
          ],
        ],
        'series' => [
          [
            'type' => 'pareto',
            'name' => 'Pareto',
            'yAxis' => 1,
            'zIndex' => 10,
            'baseSeries' => 1
          ],
          [
          'name' => 'Consumo Total',
          'type' => 'column',
          'zIndex' => 2,
          'data' => [755, 222, 151, 86, 72, 51, 36, 10]
          ]
        ],
        'exporting' => [
          'buttons' => [
            'contextButton' => [
              'menuItems' => ['printChart', 'downloadPDF', 'downloadPNG', 'downloadXLS']
            ]
          ]
        ],
      ]
    ]);
Erebril commented 5 years ago

i found the solution. turns out adding the pareto module script was needed

'modules/pareto',

final code

Highcharts::widget([
      'scripts' => [
        'modules/pareto',
        'modules/exporting',
        'modules/export-data',
        'themes/grid-light',
      ],
      'options' => [
        'credits' => [
          'enabled' => false
        ],
        'lang' => [
          'contextButtonTitle' => 'Menú contextual',
          'printChart' => 'Imprimir gráfico',
          'decimalPoint' => ',',
          'downloadPDF' => 'Descargar documento PDF',
          'downloadPNG' => 'Descargar imagen PNG',
          'downloadXLS' => 'Descargar archivo Excel'
        ],
        'chart' => [
          'type' => 'column',
        ],
        'title' => [
          'text' => 'Diagrama de Pareto',
        ],
        'subtitle' => [
          'text' => '',
        ],
        'tooltip' => [
          'shared' => true
        ],
        'xAxis' => [
          'categories' => [
            'Overpriced',
            'Small portions',
            'Wait time',
            'Food is tasteless',
            'No atmosphere',
            'Not clean',
            'Too noisy',
            'Unfriendly staff'
        ],
          'crosshair' => true,
        ],
        'yAxis' => [
          [
            'title' => [ 'text' => ''],
          ],
          [
            'title' => [ 'text' => ''],
            'minPadding' => 0,
            'maxPadding' => 0,
            'max' => 100,
            'min' => 0,
            'opposite' => true,
            'labels' => [
              'format' => "{value}%"
            ],
          ],
        ],
        'series' => [
          [
            'type' => 'pareto',
            'name' => 'Pareto',
            'yAxis' => 1,
            'zIndex' => 10,
            'baseSeries' => 1
          ],
          [
          // 'allowPointSelect' => false,
          // 'colorByPoint' => true,
          'name' => 'Consumo Total',
          'type' => 'column',
          'zIndex' => 2,
          'data' => [755, 222, 151, 86, 72, 51, 36, 10]
          ]
        ],
        'exporting' => [
          'buttons' => [
            'contextButton' => [
              'menuItems' => ['printChart', 'downloadPDF', 'downloadPNG', 'downloadXLS']
            ]
          ]
        ],
      ]
    ]);
miloschuman commented 5 years ago

Thanks for posting the follow-up solution.