我想在Highcharts Yii2中将图像添加到饼图图例中。请参阅example,但我不能将其写入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
],
...
?>发布于 2015-10-19 23:04:45
我认为应该有:
'legend' => [
'useHTML' => TRUE,
'labelFormatter' => new JsExpression('function () { return \"<img src="http://highcharts.com/demo/gfx/sun.png"/>\" + this.name; }'),
'itemMarginBottom' => 5
],根据来自here的第一条提示。
https://stackoverflow.com/questions/33215899
复制相似问题