 |
สอบถาม กราฟเส้น แสดงผลภาษาไทย ไม่ได้ ครับ (ฐานข้อมูลเป็นภาษาไทย) |
|
 |
|
|
 |
 |
|
ฐานข้อมูลเป็นภาษาไทยครับ
index_new1.php//หน้าแสดงข้อมูลกราฟเส้น
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FusionCharts graph</title>
</head>
<body>
<script language="javascript" src="Charts/FusionCharts.js"></script>
<iframe id="iframe_target2" name="iframe_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>
<table width="37%" border="0" align="center" cellpadding="1" cellspacing="1" class="sss">
<tr>
<td align="center" class="table">
<form action="../Dashboard/index_news1.php?aa1=<?=$aa1;?>" method="get" enctype="multipart/form-data" name="form" id="form" onSubmit="JavaScript:return fncSubmit();">
<label for="textfield"></label>
เลือกปีที่ต้องการค้นหา <select name="aa1" id="aa1">
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
</optgroup>
</select>
<input name="Submit" type="submit" value="Submit" >
</form>ปี
<?php
echo $aa2=$_GET["aa1"];
?>
<center><div id="chart5Div">This text is replaced by chart.</div></center>
<script type="text/javascript">
var chart2 = new FusionCharts("Charts/FCF_MSLine.swf", "ChId1", "1100", "780");
chart2.setDataURL("Data/SalesCompare_news1.php?aa2=<? echo $aa2;?>");
chart2.render("chart5Div");
</script></td>
</tr>
<tr>
<td align="center" class="table"></td>
</tr>
</table>
<br>
<div align="center"><u><a href="../a_order.php">กลับหน้าหลัก</a></u></div>
</body>
</html>
SalesCompare_news1.php
Code (PHP)
<?php
$host="localhost";
$user="";
$pass="";
$dbname="";
$conn=mysql_connect($host,$user,$pass) or die (mysql_error());
mysql_select_db($dbname) or die (mysql_error());
mysql_query("SET NAMES UTF8");
//function random
function rgb2hex($r, $g, $b, $uppercase=false, $shorten=false)
{
// The output
$out = "";
// If shorten should be attempted, determine if it is even possible
if ($shorten && ($r + $g + $b) % 17 !== 0) $shorten = false;
// Red, green and blue as color
foreach (array($r, $g, $b) as $c)
{
// The HEX equivalent
$hex = base_convert($c, 10, 16);
// If it should be shortened, and if it is possible, then
// only grab the first HEX character
if ($shorten) $out .= $hex[0];
// Otherwise add the full HEX value (if the decimal color
// is below 16 then we have to prepend a 0 to it)
else $out .= ($c < 16) ? ("0".$hex) : $hex;
}
// Package and away we go!
return $uppercase ? strtoupper($out) : $out;
}
//โค๊ด random สีกราฟ
echo "<graph numdivlines='4' lineThickness='3' showValues='0' numVDivLines='10' formatNumberScale='2' rotateNames='1' decimalPrecision='2' anchorRadius='2' anchorBgAlpha='0' numberPrefix='' divLineAlpha='30' showAlternateHGridColor='1' yAxisMinValue='800000' shadowAlpha='50' >";
echo "<categories>";
// เดือน 12 เดือน ----->>
//$aa="2014";
$aa=$_GET["aa2"];
$strQueryData = ".......";
$charset = "SET NAMES UTF8";
mysql_query($charset);
$resultData = mysql_query($strQueryData) or die(mysql_error());
while($arr=mysql_fetch_array($resultData)){
echo "<category Name='".$arr[Mydate]."'/>";
}
echo "</categories>";
$strQueryData_new = "SELECT ......";
$charset = "SET NAMES UTF8";
mysql_query($charset);
$resultData_new = mysql_query($strQueryData_new) or die(mysql_error());
while($arr_new=mysql_fetch_array($resultData_new)){
$name_ =$arr_new['V_TOTAL2_'];
echo "<dataset seriesName='".$arr_new[V_TOTAL2_]."' color='".rgb2hex(rand(0, 255), rand(0, 255), rand(0, 255), true)."' anchorBorderColor='F6BD0F' anchorRadius='4'>";
// ผลรวม sum model ทุก เดือน --------------->>
$strQueryData_new_1 = "SELECT.......";
$charset = "SET NAMES UTF8";
mysql_query($charset);
$resultData_new_1 = mysql_query($strQueryData_new_1) or die(mysql_error());
while($arr_new_1=mysql_fetch_array($resultData_new_1)){
$Mydate=$arr_new_1['Mydate'];
$V_TOTAL2_=$arr_new_1['V_TOTAL2_'];
$V_TOTAL_new=$arr_new_1['V_TOTAL_new'];
echo "<set value='".$arr_new_1['V_TOTAL_new'] / 10000 ."'/>";
}
echo "</dataset>";
}
echo "</graph>";
?>
Tag : PHP, VBScript, Action Script, Ajax, jQuery
|
ประวัติการแก้ไข 2017-06-27 11:04:38
|
 |
 |
 |
 |
Date :
2017-06-27 11:03:09 |
By :
sawmon |
View :
972 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองใช้ iconv() แปลงให้เป็น utf-8 ได้ไหม๊ครับ
|
 |
 |
 |
 |
Date :
2017-06-27 11:48:06 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$utf2tis = iconv('utf8','tis620',$string);
ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2017-06-27 11:48:06
รายละเอียดของการตอบ ::
ใช่แบบนี้รึเปล่าครับ
$utf2tis = iconv('utf8','tis620',$string);
Code (PHP)
echo "<dataset seriesName='".iconv('utf8','tis620',$arr_new[V_TOTAL2_])."' color='".rgb2hex(rand(0, 255), rand(0, 255), rand(0, 255), true)."' anchorBorderColor='F6BD0F' anchorRadius='4'>";
ยังไม่ได้ครับ
|
 |
 |
 |
 |
Date :
2017-06-27 14:33:02 |
By :
sawmon |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$coop_acc_office_name = iconv("windows-874","UTF-8",$objResult["coop_acc_office_short_name"] );
$name1 = trim($coop_acc_office_name);
|
 |
 |
 |
 |
Date :
2017-06-28 11:26:09 |
By :
panyaadd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|