pChart 2.x forum
http://wiki.pchart.net/forum/

Small Graph
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=40221
Page 1 of 1

Author:  nabster [ Wed Jan 15, 2014 4:20 am ]
Post subject:  Small Graph

G'day,
I am going in a loop and generating small fast graphs. It seems that the all the graphs that are generated after the first one are simply copies of the first. It doesn't seem to redraw the graph with new data. How can i call this program with different data array to plot different small graphs on the same page?

mygraph.php
<?php
// Standard inclusions
include("pchart/classnew/pData.class");
include("pchart/classnew/pChart.class");

// Dataset definition
$DataSet = new pData();

// SESSION['USEDGB'] changes each loop in the calling program
$DataSet->AddPoint($_SESSION['USEDGBD'],"Disk");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("CapturedData","Disk");




// Initialise the graph
$Test = new pChart(100,30);
$Test->loadColorPalette("pchart/palettes/spring.color", TRUE);
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->drawFilledRoundedRectangle(2,2,98,28,2,230,230,230);
$Test->setGraphArea(5,5,95,25);
$Test->drawGraphArea(255,255,255);
$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,FALSE,0,2);

// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());


// Finish the graph
$Test->stroke("pictures/".$_SESSION['compid']."name.png");
?>

Author:  ibilima [ Wed Jan 15, 2014 1:10 pm ]
Post subject:  Re: Small Graph

I am by no means an expert on pchart. But, maybe a suggestion may help or spark an idea for you?

Are you using an "img src=" statement in another PHP to call this one? I have multiple charts on one of my pages, and I use this method. Also, perhaps changing the name of this php image to be different each time(like adding the timestamp), may force it to create a new image?

Author:  nabster [ Wed Jan 15, 2014 10:11 pm ]
Post subject:  Re: Small Graph

Thanks for your suggestion. But that $_SESSION['compid'] is just that which changes each time so the image name is definitely different.

Any other pointers?

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/