<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
<?php // set up autoloader require_once 'ezc/Base/src/ezc_bootstrap.php' ; // initialize object $graph = new ezcGraphBarChart(); // add data points $graph->data[ 'Annual rainfall' ] = new ezcGraphArrayDataSet( array( '2002' => 18234, '2003' => 16484, '2004' => 16574, '2005' => 17464, '2006' => 19474 )); // render graph $graph->renderToOutput(500,500); ?> * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphLineChart ();
- // add data points
- $ graph-> data [ 'Annual rainfall' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphPieChart ();
- // add data points
- $ graph-> data [ 'Annual rainfall' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
Object | Chart type |
ezcGraphBarChart | Bar graph |
ezcGraphLineChart | Line graph |
ezcGraphPieChart | Pie chart |
ezcGraphRadarChart | Radar plot |
ezcGraphOdometerChart | Odometer chart |
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphRadarChart ();
- // add data sets
- $ graph-> data [ 'Televisions' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 1823,
- '2003' => 1644,
- '2004' => 1574,
- '2005' => 1764,
- '2006' => 1944,
- '2007' => 1201,
- '' => 1823
- ))
- $ graph-> data [ 'Audio systems' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 758,
- '2003' => 144,
- '2004' => 154,
- '2005' => 714,
- '2006' => 638,
- '2007' => 1038,
- '' => 758
- ))
- $ graph-> data [ 'Cameras' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 102,
- '2003' => 143,
- '2004' => 176,
- '2005' => 270,
- '2006' => 212,
- '2007' => 1112,
- '' => 102
- ))
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphOdometerChart ();
- // add data point
- $ graph-> data [ 'Televisions' ] = new ezcGraphArrayDataSet (
- array (2400)
- );
- // set odometer limits
- $ graph-> axis-> min = 0;
- $ graph-> axis-> max = 3000;
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphBarChart ();
- // add data points
- $ graph-> data [ 'Annual rainfall' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- $ graph-> data [ 'Crop production' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 50474,
- '2003' => 26749,
- '2004' => 29567,
- '2005' => 37869,
- '2006' => 79400
- ))
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphBarChart ();
- // add data points
- $ graph-> data [ 'Annual rainfall' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // set title
- $ graph-> title = 'ANNUAL RAINFALL' ;
- // set axis labels
- $ graph-> xAxis-> label = 'YEAR' ;
- $ graph-> yAxis-> label = 'MM' ;
- // set legend and title position
- $ graph-> title-> position = ezcGraph :: TOP;
- $ graph-> legend-> position = ezcGraph :: RIGHT;
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphBarChart ();
- // use green palette
- $ graph-> palette = new ezcGraphPaletteEzGreen ();
- // add data points
- $ graph-> data [ 'Annual rainfall' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphBarChart ();
- // add data points
- $ graph-> data [ 'Annual rainfall' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // set title
- $ graph-> title = 'ANNUAL RAINFALL' ;
- // set axis labels
- $ graph-> xAxis-> label = 'YEAR' ;
- $ graph-> yAxis-> label = 'MM' ;
- // set global options for font name and size
- $ graph-> options-> font-> name = 'Arial' ;
- $ graph-> options-> font-> maxFontSize = '40' ;
- // set legend and title font
- $ graph-> legend-> font-> name = 'Times New Roman' ;
- $ graph-> title-> font-> name = 'Arial' ;
- $ graph-> title-> font-> maxFontSize = '20' ;
- // set legend and title colors
- $ graph-> title-> font-> color = '# FFFF00' ;
- $ graph-> legend-> font-> color = '#FFFFFF' ;
- // set bar color
- $ graph-> data [ 'Annual rainfall' ] -> color = '# FF8040' ;
- // set legend and border colors
- $ graph-> legend-> border = '# FF8040' ;
- $ graph-> title-> borderWidth = '2' ;
- $ graph-> title-> border = '# FF00FF' ;
- $ graph-> title-> background = '# C0C0C0' ;
- // set colors for X and Y axes
- $ graph-> xAxis-> border = '# FF0000' ;
- $ graph-> yAxis-> border = '# 00FF00' ;
- // set legend and title position
- $ graph-> title-> position = ezcGraph :: TOP;
- $ graph-> legend-> position = ezcGraph :: RIGHT;
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // set up autoloader
- require_once 'ezc / Base / src / ezc_bootstrap.php' ;
- // initialize object
- $ graph = new ezcGraphBarChart ();
- // add data points
- $ graph-> data [ 'Annual rainfall' ] = new ezcGraphArrayDataSet (
- array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // set title
- $ graph-> title = 'ANNUAL RAINFALL' ;
- // set axis labels
- $ graph-> xAxis-> label = 'YEAR' ;
- $ graph-> yAxis-> label = 'MM' ;
- // repeat background image horizontally across graph bottom
- $ graph-> background-> image = 'logo.jpg' ;
- $ graph-> background-> position = ezcGraph :: BOTTOM;
- $ graph-> background-> repeat = ezcGraph :: HORIZONTAL;
- // render graph
- $ graph-> renderToOutput (500,500);
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // include class file
- include 'SVGGRaph / SVGGraph.php' ;
- // initialize object
- $ graph = new SVGGraph (400, 400);
- // add data points
- $ graph-> Values (array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // render graph
- $ graph-> Render ( 'BarGraph' );
- ?>
* This source code was highlighted with Source Code Highlighter .
- <? php
- // include class file
- include 'SVGGRaph / SVGGraph.php' ;
- // initialize object
- $ graph = new SVGGraph (400, 400);
- // add data points
- $ graph-> Values (array (
- '2002' => 18234,
- '2003' => 16484,
- '2004' => 16574,
- '2005' => 17464,
- '2006' => 19474
- ))
- // render graph
- $ graph-> Render ( 'LineGraph' );
- ?>
<?php
// include class file
include 'SVGGRaph/SVGGraph.php' ;
// initialize object
$graph = new SVGGraph(400, 400);
// add data points
$graph->Values(array(
'UK' => 50,
'US' => 30,
'Europe' => 100,
'India' => 20,
));
// render graph
$graph->Render( 'PieGraph' );
?>
* This source code was highlighted with Source Code Highlighter .
<?php
// include class file
include 'SVGGRaph/SVGGraph.php' ;
// set options
$options = array(
'back_colour' => 'white' ,
'back_stroke_colour' => 'pink' ,
'stroke_colour' => 'black' ,
'axis_colour' => 'blue' ,
'grid_colour' => 'silver' ,
'label_colour' => 'brown'
);
// initialize object
$graph = new SVGGraph(400, 400, $options);
// add data points
$graph->Values(array(
'2002' => 18234,
'2003' => 16484,
'2004' => 16574,
'2005' => 17464,
'2006' => 19474
));
// render graph
$graph->Render( 'BarGraph' );
?>
* This source code was highlighted with Source Code Highlighter .
<?php
// include class file
include 'SVGGRaph/SVGGraph.php' ;
// set options
$options = array(
'show_grid' => false ,
'show_axes' => true ,
'show_divisions' => false ,
'show_label_h' => true ,
'show_label_v' => false
);
// initialize object
$graph = new SVGGraph(400, 400, $options);
// add data points
$graph->Values(array(
'2002' => 18234,
'2003' => 16484,
'2004' => 16574,
'2005' => 17464,
'2006' => 19474
));
// render graph
$graph->Render( 'BarGraph' );
?>
* This source code was highlighted with Source Code Highlighter .
<?php
// include class file
include 'SVGGRaph/SVGGraph.php' ;
// set options
$options = array(
'show_grid' => false ,
'marker_size' => 8,
'marker_type' => 'triangle' ,
'marker_colour' => 'red'
);
// initialize object
$graph = new SVGGraph(400, 400, $options);
// add data points
$graph->Values(array(
'2002' => 18234,
'2003' => 16484,
'2004' => 16574,
'2005' => 17464,
'2006' => 19474
));
// render graph
$graph->Render( 'LineGraph' );
?>
* This source code was highlighted with Source Code Highlighter .
<?php
// include class file
include 'SVGGRaph/SVGGraph.php' ;
// initialize object
$graph = new SVGGraph(400, 400, array(
'show_label_amount' => true ,
'show_label_percent' => true ,
'label_colour' => 'black' ,
));
// add data points
$graph->Values(array(
'UK' => 50,
'US' => 30,
'Europe' => 100,
'India' => 20,
));
// render graph
$graph->Render( 'PieGraph' );
?>
* This source code was highlighted with Source Code Highlighter .
<?php
// include class file
include 'SVGGRaph/SVGGraph.php' ;
// initialize object
$graph = new SVGGraph(400, 400, array(
'show_label_amount' => true ,
'show_label_percent' => true ,
'label_colour' => 'black' ,
));
// add data points
$graph->Values(array(
'UK' => 50,
'US' => 30,
'Europe' => 100,
'India' => 20,
));
// add links
// no link for 'Europe' slice
$graph->links(array(
'UK' => 'http://example.org/UK' ,
'US' => 'http://example.org/US' ,
'India' => 'http://example.org/IN' ,
));
// render graph
$graph->Render( 'PieGraph' );
?>
* This source code was highlighted with Source Code Highlighter .
+----+------------+------+-------+
| id | date | hits | posts |
+----+------------+------+-------+
| 1 | 2010-02-01 | 3849 | 284 |
| 2 | 2010-02-02 | 3728 | 421 |
| 3 | 2010-02-03 | 3526 | 189 |
| 4 | 2010-02-04 | 4288 | 143 |
| 5 | 2010-02-05 | 4526 | 265 |
...
+----+------------+------+-------+
* This source code was highlighted with Source Code Highlighter .
<?php
// set up autoloader
require_once 'ezc/Base/src/ezc_bootstrap.php' ;
// query database for data
// formulate into arrays
try {
$pdo = new PDO( 'mysql:host=localhost;dbname=example' , 'user' , 'pass' );
$sql = "SELECT DATE_FORMAT(date, '%d') AS day, hits, posts FROM log WHERE date BETWEEN '2010-02-01' AND '2010-02-05'" ;
if ($result = $pdo->query($sql)) {
while ($row = $result->fetch()) {
$hits[$row[ 'day' ]] = $row[ 'hits' ];
$posts[$row[ 'day' ]] = $row[ 'posts' ];
}
}
} catch (PDOException $e) {
die( 'Error: ' . $e->getMessage());
}
// initialize object
$graph = new ezcGraphBarChart();
// add data sets
$graph->data[ 'Hits' ] = new ezcGraphArrayDataSet($hits);
$graph->data[ 'Posts' ] = new ezcGraphArrayDataSet($posts);
// render graph
$graph->renderToOutput(500,500);
?>
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/96568/
All Articles