Jump to content

The slightly more advanced. self-generating frame


kimjessen

Recommended Posts

hey now I have to put the pieces together. 

The project consists in the analysis of weather and solar radiation. 

I have a solar power plant on my roof and I would do some analysis on it.

and while it get a little experience with php.


so now I have found out to buffer data to my serwer. 

I have also found out how to make a graph. 

I have also found out how I'll get it right CSV file from the server. 

super! 

 

Now I would like to analyze it. 

 

is it possible to have PHP. to construct multiple frames. 

Understood in this way that when the first graph is made ther is automatically made ​​a new frame with the next day's graph ETC. 

 

it is possible


 

any suggestions.

I use JPgraph to the graph part

Link to comment
Share on other sites

hi I've tried to fiddle with this for () loop. 
but it does not work. 

 

I have attached here a simple example of the graph how will you print that FX. 3 times, below each other.
<?php // content="text/plain; charset=utf-8"
require_once('jpgraph/src/jpgraph.php');
	require_once('jpgraph/src/jpgraph_line.php');

$datay1 = array(20,15,23,15);

// Setup the graph
$graph = new Graph(300,250);
$graph->SetScale("textlin");

$theme_class=new UniversalTheme;

$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Filled Y-grid');
$graph->SetBox(false);

$graph->img->SetAntiAliasing();

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels(array('A','B','C','D'));
$graph->xgrid->SetColor('#E3E3E3');

// Create the first line
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Line 1');

$graph->legend->SetFrameWeight(1);

// Output line
$graph->Stroke();

?>

Link to comment
Share on other sites

hmmm have worked a lot with it now. 

and read about jpgraph, I think the right way is to generate 30 image files and then load them up on a html page afterwards. 

 

to just work some more with this solution, but I think that I would be able to get to work.

 

what do you say, is it the right solution?

Link to comment
Share on other sites

I think that's what Ch0cu3r suggested... You'll have to generate an image 30 times and include those 30 images in an HTML pages. I don't know why you talked about 'frames' in your first post, but using frame here doesn't make sense (if you talk about HTML frames or iframes).

 

Here's what you'll need to do (that's pseudo-code, meaning that it doesn't really work, it's just to show you the logic):

// Generates an image with the $data passed as the first parameter
// returns the image path that we created
function generateGraph($data)
  // generate an image with the $data
  // return the path of the image
  return $imagePath  

// Loop trough all image data
// Create images one by one
// Display the image
for ($i: 0 to $numberOfImages) 
  $imagePath = generateGraph($dataImage[$i]);
 echo <img src="$imagePath">

I hope it helps! :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.