php jpgraph庫非常強(qiáng)大,可以在后臺(tái)生成圖片
后臺(tái)生成在需要導(dǎo)出圖表型報(bào)告的時(shí)候非常有用,當(dāng)然,前端的可視化還是要用highcharts/echarts/anycharts等類庫
比較麻煩的是中文亂碼問題,有3個(gè)地方亂碼:


先說明下我的環(huán)境和版本:
//jpgraph_legend.inc.php 3 class Legend { 2 public $txtcol=array(); 1 //public $font_family=FF_DEFAULT,$font_style=FS_NORMAL,$font_size=8; // old. 12 0 public $font_family=FF_SIMSUN,$font_style=FS_NORMAL,$font_size=8; // old. 12記得下載一份 simsun.ttc 放到 /usr/share/fonts/truetype
//jpgraph_ttf.inc.php 9 elseif( $aFF === FF_SIMSUN ) { 8 // Do Chinese conversion 7 /* 6 if( $this->g2312 == null ) { 5 include_once 'jpgraph_gb2312.php' ; 4 $this->g2312 = new GB2312toUTF8(); 3 } 2 return $this->g2312->gb2utf8($aTxt); 1 */ 0 return $aTxt; 1 }原創(chuàng)文章,轉(zhuǎn)載請注明:http://www.survivalescaperooms.com/phpgcs/
上面的解決方法,我是參考了:
http://blog.csdn.net/yiping1980/article/details/6023144
然后后面的2個(gè)我認(rèn)為就是找到title/stickLabels源碼的地方,將 FF_DEFAULT 改為 FF_SIMSUN 即可
后來證明果然是這樣,而且方便的是 這2個(gè)家伙都在 jpgraph.php 文件中
直接
:%s/FF_DEFAULT/FF_SIMSUN/g就搞定了
title 亂碼 2 $this->title = new Text(); 1 $this->title->ParagraphAlign('center'); 0 //$this->title->SetFont(FF_DEFAULT,FS_NORMAL); //FF_FONT2, FS_BOLD 1 $this->title->SetFont(FF_SIMSUN,FS_NORMAL); //FF_FONT2, FS_BOLDstickLables 亂碼 5 class AxisPRototype { 4 public $scale=null; 3 public $img=null; 2 public $hide=false,$hide_labels=false; 1 public $title=null; 0 public $font_family=FF_DEFAULT,$font_style=FS_NORMAL,$font_size=8,$label_angle=0; 還有個(gè)地方也有FF_DEFAULT,
5 class DisplayValue { 4 public $margin=5; 3 public $show=false; 2 public $valign='',$halign='center'; 1 public $format='%.1f',$negformat=''; 0 private $ff=FF_DEFAULT,$fs=FS_NORMAL,$fsize=8; 總結(jié):原創(chuàng)文章,轉(zhuǎn)載請注明:http://www.survivalescaperooms.com/phpgcs/


新聞熱點(diǎn)
疑難解答
圖片精選