2amigos/yii2-highcharts-widget -> Uncaught TypeError

I am converting some highcharts charts that I generated without Yii. Now I;m using Yii2 and 2amigos/yii2-highcharts-widget plugin, but I’m having a small problem:


                'plotOptions' => [

                  'column' => [

                    'stacking' => 'normal',

                    'dataLabels' => [

                      'enabled' => true,

                      'style' => [

                        'textShadow' => false,

                        'fontSize' => '20px',

                      ],

                      'formatter' => 'function(){return this.y;}',

                    ]

                  ],

                  'line' => [

                    'marker' => [

                      'enabled' => false

                    ]

                  ]

                ],

When I run this I’m getting Uncaught TypeError: options.formatter.call is not a function. I’m not sure what i’ve done wrong here. Does anyone have any ideas. I checked how this was being rendered in the browser and it seemed to be fine:

[html]"plotOptions":{

  "column":{


    "stacking":"normal",


    "dataLabels":{


      "enabled":true,


      "style":{


        "textShadow":false,


        "fontSize":"20px"


      },


      "formatter":"function(){return this.y;}"


      }


    },[/html]

Try




'formatter' => new \yii\web\JsExpression('function(){return this.y;}'),



Thanks Bizley!

I had been trying things like


'formatter' => 'js:function(){return this.y;}',

similar to Yii 1 Grids!

Thanks

:D