[英]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.