Heim > php教程 > PHP源码 > jpgraph某个时间段的数据统计

jpgraph某个时间段的数据统计

PHP中文网
Freigeben: 2016-05-25 17:07:35
Original
1152 Leute haben es durchsucht

跳至

<?php // content="text/plain; charset=utf-8"
require_once (&#39;jpgraph/jpgraph.php&#39;);
require_once (&#39;jpgraph/jpgraph_line.php&#39;);
require_once (&#39;jpgraph/jpgraph_date.php&#39;);
 
// Create a data set in range (50,70) and X-positions
DEFINE(&#39;NDATAPOINTS&#39;,3600);
DEFINE(&#39;SAMPLERATE&#39;,2); 
$start = time();
 //var_dump($start);exit();
$end = $start+NDATAPOINTS*SAMPLERATE;
$data = array();
$xdata = array();
for( $i=0; $i < NDATAPOINTS; ++$i ) {
    $data[$i] = rand(39,100);
    $xdata[$i] = $start + $i * SAMPLERATE;
}
 
 //var_dump($data);exit();
// Create the new graph
$graph = new Graph(540,300);
 
// Slightly larger than normal margins at the bottom to have room for
// the x-axis labels
$graph->SetMargin(40,40,30,130);
 
// Fix the Y-scale to go between [0,100] and use date for the x-axis
$graph->SetScale(&#39;datlin&#39;,0,200);
//$graph->title->Set("hello");
 
// Set the angle for the labels to 90 degrees
$graph->xaxis->SetLabelAngle(90);
 
$line = new LinePlot($data,$xdata);
$line->SetFillColor(&#39;lightblue@0.9&#39;);
$graph->Add($line);
$graph->Stroke();
?>
Nach dem Login kopieren

                   

Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage