簡體   English   中英

函數中的Yii2 Highcharts語法

[英]Yii2 Highcharts syntax in function

我想將圖像添加到Highcharts Yii2中的餅圖例中。 參見示例,但我無法將其寫入labelFormat部分的PHP小部件中。

<? = \dosamigos\highcharts\HighCharts::widget([
  'clientOptions' => [
    'chart' => [
      'type' => 'pie'
    ],
    'legend' => [
      'useHTML' => TRUE,
      'labelFormatter' => "function () {
        return '<img src='http://highcharts.com/demo/gfx/sun.png'/>' + this.name;
      }",
      'itemMarginBottom' => 5
    ],
    ...
?>

我認為應該有:

'legend' => [
  'useHTML' => TRUE,
  'labelFormatter' => new JsExpression('function () { return \"<img src="http://highcharts.com/demo/gfx/sun.png"/>\" + this.name; }'),
  'itemMarginBottom' => 5
],

根據第一個提示從這里開始

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM