|
|
|
ช่วยดูโค๊ดให้หน่อยครับ รับค่าจาก database มาพอตกราฟ |
|
|
|
|
|
|
|
รับค่าจาก database มาพอตกราฟ คือได้ background ของกราฟแล้วครับ แต่กราฟไม่ขึ้น ต้องเพิ่มส่วนไหนครับ ขอบคุณครับ --
Code (PHP)
<?php
session_start();
$host="127.0.0.1";
$user="root";
$passwd="admin";
$dbname="pchart";
$sql = "SELECT*FROM chart WHERE type='$type' AND amount='$amount'";
include("pChart/pData.class");
include("pChart/pChart.class");
$DataSet = new pData;
$DataSet->AddPoint(array(amount),"amount");
$DataSet->AddPoint(array(type),"type");
$DataSet->AddSerie("amount");
$DataSet->SetAbsciseLabelSerie("type");
$DataSet->SetYAxisName("amount");
$DataSet->SetYAxisUnit("units");
$Graph = new pChart(700,230);
$Graph->setFontProperties("Fonts/tahoma.ttf",8);
$Graph->setGraphArea(70,30,680,200);
$Graph->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
$Graph->drawRoundedRectangle(5,5,695,225,5,230,230,230);
$Graph->drawGraphArea(255,255,255,TRUE);
$Graph->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2);
$Graph->drawGrid(4,TRUE,230,230,230,50);
$Graph->setFontProperties("Fonts/tahoma.ttf",6);
$Graph->drawTreshold(0,143,55,72,TRUE,TRUE);
$Graph->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());
$Graph->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);
$Graph->setFontProperties("Fonts/tahoma.ttf",8);
$Graph->drawLegend(75,35,$DataSet->GetDataDescription(),255,255,255);
$Graph->setFontProperties("Fonts/tahoma.ttf",10);
$Graph->drawTitle(60,22,"Computer store",50,50,50,585);
$Graph->Stroke("example1.png");
?>
Tag : PHP, Windows
|
|
|
|
|
|
Date :
2012-12-08 21:12:55 |
By :
defter |
View :
886 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|