PHP JpGraph中文乱码解决方式
程序员文章站
2022-06-03 09:09:13
...
JpGraph默认不支持中文,需要我们进行设置
但是实际测试中,我们只需要修改2个地方即可,位置是jpgraph_ttf.inc.php
SetScale('intlin');$graph->SetShadow();// Setup margin and titles$graph->SetMargin(40,20,20,40);$graph->title->Set('标题---统计图');$graph->subtitle->Set('(March 12, 2008)');$graph->xaxis->title->Set('X(跨度)');$graph->yaxis->title->Set('Y(指数)');// Create the first data series$lineplot=new LinePlot($ydata);$lineplot->SetWeight( 2 ); // Two pixel wide// Add the plot to the graph$graph->Add($lineplot);// Create the second data series$lineplot2=new LinePlot($ydata2);$lineplot2->SetWeight( 2 ); // Two pixel wide// Add the second plot to the graph$graph->Add($lineplot2);// Display the graph$graph->Stroke();?>