yii2-highcharts-widget icon indicating copy to clipboard operation
yii2-highcharts-widget copied to clipboard

How to format Y-Axis ?

Open desaikalpesh34 opened this issue 3 years ago • 0 comments

How to format Y-Axis ? i want to prefix or postfix $ symbol on Y-Axis. i checked HighChart documentation there is option to do like this

yAxis: { 
  title: { text: 'Temperature (Celsius)' } ,
  labels: {
    formatter: function() {
      return this.value + '$';
    }
  }
}

how to integrate same thing inthis widget(how to call this anonymous function via php )

$yAxisConfig = [
          'title' => [
              'text' => $yaxisTitle
          ],
          'labels'=>[
              'formatter'=>function(){
              return $this.value . '$';
             },
         ]
      ];
echo \dosamigos\highcharts\HighCharts::widget([
  'clientOptions' => [
      'chart' => [
              'type' => $searchModel->graphType?$searchModel->graphType:'line',
      ],
      'title' => [
           'text' => 'Facility Order Report'
           ],
      'xAxis' => [
          'categories' => $categoriesDate
      ],
      'yAxis' => $yAxisConfig,
      'series' => $dataArray
  ]
]);

i tried many ways but its not working can you guide how to achieve though widget.

desaikalpesh34 avatar Jun 05 '21 03:06 desaikalpesh34