JPGraph无法显示的问题

时间:2013-05-26 11:00:56

标签: php html graph jpgraph

我正在尝试从mysql数据中检索数据并在运行会话的PHP页面中显示它。代码在单独的页面中运行。并且数据在另一页中作为图像检索。 主要问题是无论我在默认图形编码之上放置什么样的编码,它都将成为一个破碎的图像。仅供参考我已启用php_gd2.dll,并且我的php.ini文件中的扩展名已设置为扩展名文件夹。是否还需要在任何文件中进行其他修复?

<?php
session_start();

if($_SESSION['username'])
{
require "dbc.php";  
echo "<h2>Patient Glucose Data</h2>";

$username = $_SESSION['username'];
$query_view = mysql_query("SELECT * FROM user_glucose WHERE username='$username'");

$numrows = mysql_num_rows($query_view);

    if ($numrows != 0)
    {
        while ($rows = mysql_fetch_assoc($query_view))
        {

        $print_day1  = $rows['Day1'];
        $print_day2  = $rows['Day2'];
        $print_day3  = $rows['Day3'];
        $print_day4  = $rows['Day4'];
        $print_day5  = $rows['Day5'];
        $print_day6  = $rows['Day6'];
        $print_day7  = $rows['Day7'];
        $print_day8  = $rows['Day8'];
        $print_day9  = $rows['Day9'];
        $print_day10 = $rows['Day10'];
        $print_day11 = $rows['Day11'];
        $print_day12 = $rows['Day12'];
        $print_day13 = $rows['Day13'];
        $print_day14 = $rows['Day14'];


        }

    }
    require('/jpgraph-3.5.0b1/src/jpgraph.php');
    require('/jpgraph-3.5.0b1/src/jpgraph_line.php'); 

    //  data
    $ydata =       
array($print_day1,$print_day2,$print_day3,$print_day4,$print_day5,$print_day6,$print_day7,$print_day8,$print_day9);

// Create the graph. These two calls are always required
$graph = new Graph(500,500);
$graph->SetScale('textlin');
$graph->xaxis->title->Set("Number of Days");
$graph->yaxis->title->Set("Glucose Concentration");

// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->SetColor('blue');

// Add the plot to the graph
$graph->Add($lineplot);

// Display the graph
$graph->Stroke();

 }
 ?>

0 个答案:

没有答案