JpGraph サンプル

← 一覧に戻る
<?php // content="text/plain; charset=utf-8"
require_once ("jpgraph/jpgraph.php");
require_once ("jpgraph/jpgraph_line.php");
require_once ("jpgraph/jpgraph_bar.php");


// Create datapoints where every point
for($i=0; $i<$steps; ++$i) {
	$databarx[]=sprintf("198%d %s",floor($i/12),$month[$i%12]);
	// Simulate an accumulated value for every 5:th data point
	if( $i % 6 == 0 ) {
	else {

// New graph with a background image and drop shadow
$graph = new Graph(450,300);

// Use an integer X-scale

// Set title and subtitle
$graph->title->Set("Combined bar and line plot");
$graph->subtitle->Set("100 data points, X-Scale: 'text'");

// Use built in font

// Make the margin around the plot a little bit bigger
// then default

// Slightly adjust the legend from it's default position in the
// top right corner to middle right side

// Display every 10:th datalabel

// Create a red line plot
$p1 = new LinePlot($datay);

// Create the bar plot
$b1 = new BarPlot($databary);

// The order the plots are added determines who's ontop

// Finally output the  image


← 一覧に戻る