こんにちは、Zend Report コントローラー スクリプトでハイチャートの変数を次のように設定しています。
$chartOptions = array(
"chart"=> array(
//chart type
"type" => "bar",
"spacingBottom" => 25
),
"height"=>1,
"title" => array(
"text" => $spm->getFullName()
),
等
私が最終的に使いたいjsonにもこれがあります:
exporting: {
buttons: {
exportButton: {
menuItems: [{
text: 'Export to PNG (with text)',
onclick: function() {
this.exportChart({},{
labels: {
items:[{
html: "System: x.x.x, Date/Time: 30:05:2012 14:32:00",
style: {
left: '50%',
top: '250px'
}
}]
}
});
}
}, {
text: 'Export to PNG (default)',
onclick: function() {
this.exportChart();
}
},
null,
null
]
}
}
}
したがって、次のように PHP 配列をセットアップする必要があります。
$chartOptions = array(
"chart"=> array(
//chart type
"type" => "bar",
"spacingBottom" => 25
),
"height"=>1,
"title" => array(
"text" => $spm->getFullName()
),
"exporting" => "buttons" =>
等々。しかし、javascript関数のため、それを行う方法がわかりません。Zend レポート コントローラーはすべての変数をビュー スクリプトにコピーします。php を json に変換する方法はわかりませんが、実際に機能します。
私が望むのは、出力されたjsonに上記のjavascriptを含めることだけです。ありがとう!