1
我正在開發CodeIgniter框架中的PHP項目。此應用程序包含許多動態創建的圖形。我與ronan-gloo highcharts library合作非常成功。下面是我的生成圖形代碼...Highcharts向下鑽取圖表CodeIgniter
$this -> load -> library ('Highchart');
$chart = new Highchart ();
$chart -> chart -> renderTo = "divid";
$chart -> title -> text = "chart Title";
$chart -> xAxis -> categories = $xaxis;
$chart -> tooltip -> formatter = new HighchartJsExpr ("function() {
var s;
if (this.point.name) { // the pie chart
s = ''+
this.point.name +': '+ this.y;
} else {
s = '<b>'+ this.series.name +'</b><br/><i>' + this.x +'</i>: <b>'+ this.y + '%</b>';
}
return s; }");
$chart -> series [ ] = array (
'type' => "column" ,
'name' => "%age" ,
'data' => $yaxis ,
'color' => '#CC004B' ,
'showInLegend' => TRUE ,
'dataLabels' => array (
'enabled' => TRUE ,
'color' => '#CC004B' ,
'style' => array (
'fontSize' => '10px' ,
'verticalalign' => 'bottom'
)
)
);
foreach ($chart->getScripts() as $script) {
echo '<script type="text/javascript" src="' . $script . '"></script>';
}
echo "<script src='" . base_url () . "assets/js/jquery.cookie.js'></script>";
echo "<script type='text/javascript' src='" . base_url () . "assets/highcharts/js/exporting.js'></script>";
echo "<div id='divid'></div>";
echo "<script type='text/javascript'>" . $chart -> render ("chart1") . "</script>";
,這是幫助我更大的延伸到創建圖形,但是,Highcharts有很大的向下鑽取功能(High Charts Drilldown demo),這也是我希望在實現我的項目。
該演示建議創建JavaScript對象,該對象包含用於創建圖表的深入數據()。但我怎麼能在PHP Codeigniter的JavaScript寫在飛行...
請幫助!