Mantis 1.2.x 圖表顯示中文及大小設定

Mantis 1.2.x 的圖型報表,無法正常顯示中文,以及顯示的X軸字型太小的問題,需要透過修改程式來修正:

測試版本:1.2.15

顯示中文:

  • 首先要上傳UNICODE的True Type字型到Server上
  • 接著修改plugins/MantisGraph/core/graph_api.php:
例如我們選擇把arialuni.ttf來取代掉原來的Arial字型的話,只要將檔案中,把所有arial.ttf改成arialuni.ttf即可。這版的Mantis不用修改太多的程式,就能顯示中文。


圖表X-軸字型大小調整:
修改plugins/MantisGraph/core/graph_api.php:
找到「function graph_bar」:

$graph->options->font = $t_graph_font ;
$graph->options->font->maxFontSize = 12;
$graph->legend = false;
於下方新增一行:
$graph->options->font->minFontSize = 10; 

此行是設定最小字型大小

接著找到:
$graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer();
$graph->xAxis->axisLabelRenderer->angle = 45;
加入一行:
$graph->xAxis->axisSpace = 0.2;
 修改完後,Mantis就能正常顯示中文圖表,而且X軸字型不會太小了

留言

這個網誌中的熱門文章

Google瀏覽器發生「錯誤107 (net::ERR_SSL_PROTOCOL_ERROR): SSL 通訊協定錯誤」的解決方式

Cacti 簡單自製圖表詳解