i get a few values from the DB and i put it into an array what should happen next is
that the said values from the array don't get into the graph and thus no graph is displayed
saying there are no values.
personally i think there are no values coming from the query. This is the code.
load percentage has the the values from the cpu load (1% to 100%)
incase none are familiar with JPgraph i put what the lines are supposed to do in the comment.
Code: Select all
<?php
//report errors
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
//include these for a correct build up of the graphs
include ("../system/jpgraph-2.1.2/src/jpgraph.php");
include ("../system/jpgraph-2.1.2/src/jpgraph_line.php");
$objConn = new COM("adodb.connection");
$objConn->Open
("dsn=Gispen_Inventory;server=@@@@@.@@@@@@;database=@@@@_ICT;Trusted_Connection=yes");
$rs = $objConn->Execute("SELECT TOP 30 LoadPercentage, LastCheck, ServerName
FROM dbo.@@@@_Server_CPU_gebruik
WHERE (ServerName = 'DC0001')
ORDER BY LastCheck DESC");
// getting the data from the query here
while (!$rs->EOF)
{
$s_LastCheck = $rs->Fields['LastCheck']->value;
$s_ServerName = $rs->Fields['ServerName']->value;
$s_LoadPercentage = $rs->Fields['LoadPercentage']->value;
$rs->MoveNext();
}
// Creating the graph here
$graph = new Graph(350,250,"auto");
// setting scale here
$graph->SetScale( "textlin",0,100 );
// this is the graph name
$graph->title->Set ("$s_ServerName");
// names for the axis
$graph->xaxis-> title->Set("horizontaal" );
$graph->yaxis-> title->Set("verticaal" );
// here is the line created according to
// the data in the variable
$lineplot=new LinePlot($s_LoadPercentage);
// show the values and set the color to blue
$lineplot->SetColor("blue");
$lineplot->value-> Show();
// Add the plot to the graph
$graph->Add($lineplot);
// Display the graph
$graph->Stroke();
?>A plot has an illigal scale. this could for example be that you are trying to use auto scaling to draw a lineplot with only 1 point or that the plot area is to small.
It could also be that no input data value is numeric (perhaps only '-' or 'x')
(All input data is numeric. it has more than 1 point and the area is not to small(i think))