下載libchart
轉自:http://blog.csdn.net/dj0379/article/details/7451946
Libchart繪製圖表的確很好用,唯一可惜的就是對中文支援不好,在圖表裡顯示為亂碼。琢磨了一下,運用之前修改dotproject中文亂碼問題的經驗,改了改Libchart,現在成功的支援中文字型了。
做法很簡單:
1、自己寫的使用Libchart庫組建圖表的php檔案以utf-8編碼儲存
2、找幾個中文字型庫,比如華文行楷、宋體等等,複製到libchart\fonts目錄下
3、修改libchart\classes目錄下的text.php檔案
第47、48行
$this->fontCondensed = dirname(__FILE__) . “/../fonts/DejaVuSansCondensed.ttf”;
$this->fontCondensedBold = dirname(__FILE__) . “/../fonts/DejaVuSansCondensed-Bold.ttf”;
改為
$this->fontCondensed = dirname(__FILE__) . “/../fonts/你找來的中文字型”;
$this->fontCondensedBold = dirname(__FILE__) . “/../fonts/你找來的中文字型”;
now,圖表裡現在顯示中文了。
轉自:http://blog.csdn.net/dj0379/article/details/7451946
Libchart繪製圖表的確很好用,唯一可惜的就是對中文支援不好,在圖表裡顯示為亂碼。琢磨了一下,運用之前修改dotproject中文亂碼問題的經驗,改了改Libchart,現在成功的支援中文字型了。
做法很簡單:
1、自己寫的使用Libchart庫組建圖表的php檔案以utf-8編碼儲存
2、找幾個中文字型庫,比如華文行楷、宋體等等,複製到libchart\fonts目錄下
3、修改libchart\classes目錄下的text.php檔案
第47、48行
$this->fontCondensed = dirname(__FILE__) . “/../fonts/DejaVuSansCondensed.ttf”;
$this->fontCondensedBold = dirname(__FILE__) . “/../fonts/DejaVuSansCondensed-Bold.ttf”;
改為
$this->fontCondensed = dirname(__FILE__) . “/../fonts/你找來的中文字型”;
$this->fontCondensedBold = dirname(__FILE__) . “/../fonts/你找來的中文字型”;
now,圖表裡現在顯示中文了。