Source for file barchart1.php
Documentation is available at barchart1.php
include('Image/Graph.php');
$Graph = & Image_Graph ::factory ('graph', array (400 , 300 ));
$Arial = & $Graph->addNew ('ttf_font', 'arial.ttf');
// set the font size to 15 pixels
$Arial1 = & $Graph->addNew ('ttf_font', 'arial.ttf');
// set the font size to 15 pixels
$Arial2 = & $Graph->addNew ('ttf_font', 'arial.ttf');
// set the font size to 15 pixels
Image_Graph ::factory ('title', array ('German Car Popularity', &$Arial)),
Image_Graph ::factory ('title', array ('Popularity', &$Arial1)),
$Plotarea = Image_Graph ::factory ('plotarea'),
$Legend = Image_Graph ::factory ('legend'),
Image_Graph ::factory ('title', array ('Defects / 1000 units', &$Arial2)),
$Legend->setPlotArea ($Plotarea);
$Dataset = & Image_Graph ::factory ('dataset');
$Dataset->addPoint ('Audi', 100 );
$Dataset->addPoint ('Mercedes', 41 );
$Dataset->addPoint ('Porsche', 78 );
$Dataset->addPoint ('BMW', 12 );
//$Dataset =& Image_Graph::factory('random', array(10, 2, 15, true));
$Dataset2 = & Image_Graph ::factory ('dataset');
$Dataset2->addPoint ('Audi', 10 );
$Dataset2->addPoint ('Mercedes', 17 );
$Dataset2->addPoint ('Porsche', 12 );
$Dataset2->addPoint ('BMW', 21 );
// create the plot as bar chart using the dataset
$Plot = & $Plotarea->addNew ('bar', array (&$Dataset, 'normal', 'Popularity'));
$FillArray = & Image_Graph ::factory ('Image_Graph_Fill_Array');
$Plot->setFillStyle ($FillArray);
$Marker = & $Graph->addNew ('Image_Graph_Marker_Array');
$Marker->addNew ('Image_Graph_Marker_Icon', './images/audi.png');
$Marker->addNew ('Image_Graph_Marker_Icon', './images/mercedes.png');
$Marker->addNew ('Image_Graph_Marker_Icon', './images/porsche.png');
$Marker->addNew ('Image_Graph_Marker_Icon', './images/bmw.png');
$Plot->setMarker ($Marker);
$Plot2->setLineColor ('blue@0.4');
$Plot2->setMarker ($Marker);
$AxisY->setDataPreprocessor (Image_Graph ::factory ('Image_Graph_DataPreprocessor_Formatted', '%0.0f%%'));
$AxisY->forceMaximum (105 );
Documentation generated on Mon, 11 Mar 2019 13:57:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|