Image_Graph
[ class tree: Image_Graph ] [ index: Image_Graph ] [ all elements ]

Source for file piechart1.php

Documentation is available at piechart1.php

  1. <?php
  2.     include('Image/Graph.php');
  3.     
  4.     // create the graph
  5.     $Graph =Image_Graph::factory('graph'array(400300));
  6.  
  7.     // add a TrueType font
  8.     $Arial =$Graph->addNew('ttf_font''arial.ttf');
  9.     // set the font size to 11 pixels
  10.     $Arial->setSize(11);
  11.     // add a title using the created font    
  12.         
  13.     // create the plotarea
  14.     $Graph->add(
  15.         Image_Graph::vertical(
  16.             Image_Graph::factory('title'array('Meat Export'&$Arial)),
  17.             $Plotarea = Image_Graph::factory('plotarea'),
  18.             5            
  19.         )
  20.     );
  21.             
  22.     // create the 1st dataset
  23.     $Dataset1 =Image_Graph::factory('dataset');
  24.     $Dataset1->addPoint('Beef'rand(110));
  25.     $Dataset1->addPoint('Pork'rand(110));
  26.     $Dataset1->addPoint('Poultry'rand(110));
  27.     $Dataset1->addPoint('Camels'rand(110));
  28.     $Dataset1->addPoint('Other'rand(110));
  29.     // create the 1st plot as smoothed area chart using the 1st dataset
  30.     $Plot1 =$Plotarea->addNew('Image_Graph_Plot_Pie'&$Dataset1);
  31.     $Plotarea->hideAxis();
  32.     
  33.     // create a Y data value marker
  34.     $Marker =$Plot1->addNew('Image_Graph_Marker_Value'VALUE_X);
  35.     // create a pin-point marker type
  36.     $PointingMarker =$Plot1->addNew('Image_Graph_Marker_Pointing_Angular'array(20&$Marker));
  37.     // and use the marker on the 1st plot
  38.     $Plot1->setMarker($PointingMarker);    
  39.     // format value marker labels as percentage values
  40.     
  41.     $Plot1->Radius = 2;
  42.     
  43.     $FillArray =Image_Graph::factory('Image_Graph_Fill_Array');
  44.     $Plot1->setFillStyle($FillArray);
  45.     $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'green''white'));
  46.     $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'blue''white'));
  47.     $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'yellow''white'));
  48.     $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'red''white'));
  49.     $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'orange''white'));
  50.         
  51.     // output the Graph
  52.     $Graph->done();
  53. ?>

Documentation generated on Mon, 11 Mar 2019 13:57:46 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.