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. $Font =$Graph->addNew('ttf_font''Gothic');
  9. // set the font size to 7 pixels
  10. $Font->setSize(7);
  11.  
  12. $Graph->setFont($Font);
  13.     
  14. // create the plotarea
  15. $Graph->add(
  16.         Image_Graph::factory('title'array('Meat Export'12)),
  17.         Image_Graph::horizontal(
  18.             $Plotarea Image_Graph::factory('plotarea'),
  19.             $Legend Image_Graph::factory('legend'),
  20.             70
  21.         ),
  22.         5            
  23.     )
  24. );
  25.  
  26. $Legend->setPlotarea($Plotarea);
  27.         
  28. // create the 1st dataset
  29. $Dataset1 =Image_Graph::factory('dataset');
  30. $Dataset1->addPoint('Beef'rand(110));
  31. $Dataset1->addPoint('Pork'rand(110));
  32. $Dataset1->addPoint('Poultry'rand(110));
  33. $Dataset1->addPoint('Camels'rand(110));
  34. $Dataset1->addPoint('Other'rand(110));
  35. // create the 1st plot as smoothed area chart using the 1st dataset
  36. $Plot =$Plotarea->addNew('pie'&$Dataset1);
  37. $Plotarea->hideAxis();
  38.  
  39. // create a Y data value marker
  40. $Marker =$Plot->addNew('value_marker'IMAGE_GRAPH_PCT_Y_TOTAL);
  41. // create a pin-point marker type
  42. $PointingMarker =$Plot->addNew('Image_Graph_Marker_Pointing_Angular'array(20&$Marker));
  43. // and use the marker on the 1st plot
  44. $Plot->setMarker($PointingMarker);    
  45. // format value marker labels as percentage values
  46. $Marker->setDataPreprocessor(Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted''%0.1f%%'));
  47.  
  48. $Plot->Radius = 2;
  49.  
  50. $FillArray =Image_Graph::factory('Image_Graph_Fill_Array');
  51. $Plot->setFillStyle($FillArray);
  52. $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'white''green'));
  53. $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'white''blue'));
  54. $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'white''yellow'));
  55. $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'white''red'));
  56. $FillArray->addNew('gradient'array(IMAGE_GRAPH_GRAD_RADIAL'white''orange'));
  57.  
  58. $Plot->explode(5);
  59.        
  60. // output the Graph
  61. $Graph->done();
  62. ?>

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