 |
JP Graph แสดงภาษาไทยไม่ได้ครับ มันขึ้นเป็น สี่เหลี่ยม |
|
 |
|
|
 |
 |
|
ภาษาอังกฤษแสดงได้ปกติ แต่ภาษาไทยมันกลายเป็นเหลี่ยมๆ ผมได้ตั้งค่าตามนี้แล้ว http://gotoknow.org/blog/hunnan/181833 ก็ยังไม่ได้เกิดจากสาเหตุใด ช่วยชี้แนะด้วยครับ ขอบคุณล่วงหน้าครับ
Code
<?php
@header("Content-Type: text/html; charset=UTF-8");
// Example for use of JpGraph,
// ljp, 01/03/01 20:32
require("jpgraph/src/jpgraph.php"); //this is path of tool
require("jpgraph/src/jpgraph_bar.php");
//require("jpgraph/src/jpgraph_flags.php");
// We need some data
$datay=array(0.13,0.25,0.21,0.35,0.31,0.06);
$m1 = iconv('TIS-620', 'UTF-8',"มกราคม1f");
$m1 = "มกราคม1f";
$datax=array($m1,"Feb","Mar","Apr","May","June");
// Setup the graph.
$graph = new Graph(600,400,"auto");
$graph->img->SetMargin(60,40,50,120);
$graph->SetScale("textlin");
$graph->SetMarginColor("lightblue");
$graph->SetShadow();
// Set up the title for the graph
$title = "รายงานแสดงค่าใช้จ่ายต่อเดือนtest";
$graph->title->SetFont(FF_TAHOMA, FS_BOLD, 16);
$graph->title->Set($title);
//$graph->title->Set('ทดสอบบบบบ');
$graph->subtitle->SetFont(FF_TAHOMA, FS_BOLD,18);
$m=iconv('TIS-620','UTF-8',"ทดสอบการสร้างกราฟ");
$graph->subtitle->Set($m);
//$graph->title->SetFont(FF_TAHOMA,FS_NORMAL,12);
$graph->title->SetColor("darkred");
$graph->legend->SetFont(FF_TAHOMA,FS_BOLD);
// Setup font for axis
$graph->xaxis->SetFont(FF_TAHOMA,FS_NORMAL,12);
$graph->yaxis->SetFont(FF_TAHOMA,FS_NORMAL,12);
// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
// Setup X-axis labels
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(50);
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
// Setup color for gradient fill style
$bplot->SetFillGradient("navy","#EEEEEE",GRAD_LEFT_REFLECTION);
// Set color for the frame of each bar
$bplot->SetColor("white");
$graph->Add($bplot);
$bplot->value->Show();
// Finally send the graph to the browser
$graph->xaxis->SetFont(FF_ANGSA,FS_BOLD,20);
$graph->Stroke();
?>
ผลที่ได้

ผมได้ใช้ฟังก์ชั่น iconv แล้วก็ยังไม่ได้แล้ว
Tag : PHP, MySQL, CakePHP
|
ประวัติการแก้ไข 2010-10-14 16:13:08
|
 |
 |
 |
 |
Date :
2010-10-14 16:11:17 |
By :
kittis@k |
View :
1930 |
Reply :
6 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หาดูครับ เคยมีคนตอบไว้ เปลี่ยนเป็น angsana ดูหรือยัง
|
 |
 |
 |
 |
Date :
2010-10-14 16:25:08 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เปลี่ยนเป็น FF_ANGSA, FF_CORDIA ,FF_TAHOMA หมดแล้วครับพี่ iconv ก็ลองแปลงหมดแล้ว ไม่ว่าจะเป็นUTF-8,TIS-620,WINDOWS-874 ครับ
มันยังเป็นสี่เหลี่ยม เหมือนเดิมครับ
Code
$title = iconv('UTF-8', 'TIS-620',"รายงานแสดงค่าใช้จ่ายต่อเดือนtest");
$graph->title->SetFont(FF_ANGSA, FS_BOLD, 16);
$graph->title->Set($title);
ผลลัพธ์

Code
$title = iconv('TIS-620', 'UTF-8',"รายงานแสดงค่าใช้จ่ายต่อเดือนtest");
$graph->title->SetFont(FF_ANGSA, FS_BOLD, 16);
$graph->title->Set($title);
ผลลัพธ์

|
ประวัติการแก้ไข 2010-10-14 17:01:07
 |
 |
 |
 |
Date :
2010-10-14 16:45:34 |
By :
kittis@k |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ version ไหนครับ
|
 |
 |
 |
 |
Date :
2010-10-14 17:02:51 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
jpgraph-3.0.7.tar.bz2 ครับพี่ นี่คือชื่อไฟล์ที่โหลดมาครับผม
|
 |
 |
 |
 |
Date :
2010-10-14 17:23:21 |
By :
kittis@k |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|