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