Proposal for "Graphpite"

» Metadata » Status
» Description
GraPHPite is a versatile graph creation utility. It uses OO features to utilize the creation in a java-style fashion. GraPHPite is a working project.

A PEAR example could be:

<?php
include("Image/Graphpite.php");

// create the graph
$Graph =& new Image_Graphpite(400, 300);

// add a TrueType font
$Arial=& $Graph->addFont(new Image_Graphpite_Font_TTF("arial.ttf"));
// set the font size to 15 pixels
$Arial->setSize(11);

// create the plotarea
$Graph->add(
new Image_Graphpite_Layout_Vertical(
new Image_Graphpite_Title("Antialiased pie chart", $Arial),
$PlotArea = new Image_Graphpite_Plotarea(),
5
)
);

// create the dataset
$DataSet = & new Image_Graphpite_Dataset_Trivial();
$DataSet->addPoint("Beef", rand(1, 10));
$DataSet->addPoint("Pork", rand(1, 10));
$DataSet->addPoint("Poultry", rand(1, 10));
$DataSet->addPoint("Camels", rand(1, 10));
$DataSet->addPoint("Other", rand(1, 10));
// create the plot as pie chart using the dataset
$Plot =& $PlotArea->addPlot(new Image_Graphpite_Plot_Pie($DataSet));
$PlotArea->hideAxis();

// create a Y data value marker
$Marker =& $Plot->add(new Image_Graphpite_Marker_Value(IMAGE_GRAPHPIE_VALUE_X));
// fill it with white
$Marker->setFillColor(IMAGE_GRAPHPITE_WHITE);
// and use black border
$Marker->setBorderColor(IMAGE_GRAPHPITE_BLACK);
// create a pin-point marker type
$PointingMarker =& $Plot->add(new Image_Graphpite_Marker_Pointing_Angular(20, $Marker));
// and use the marker on the plot
$Plot->setMarker($PointingMarker);
// format value marker labels as percentage values
$Plot->Radius = 2;

// create a fillstyle for the plot
$FillArray = & new Image_Graphpite_Fill_Array();
$Plot->setFillStyle($FillArray);
$FillArray->add(new Image_Graphpite_Fill_Gradient(IMAGE_GRAPHPITE_GRAD_RADIAL, IMAGE_GRAPHPITE_GREEN, IMAGE_GRAPHPITE_WHITE, 200));
$FillArray->add(new Image_Graphpite_Fill_Gradient(IMAGE_GRAPHPITE_GRAD_RADIAL, IMAGE_GRAPHPITE_BLUE, IMAGE_GRAPHPITE_WHITE, 200));
$FillArray->add(new Image_Graphpite_Fill_Gradient(IMAGE_GRAPHPITE_GRAD_RADIAL, IMAGE_GRAPHPITE_YELLOW, IMAGE_GRAPHPITE_WHITE, 200));
$FillArray->add(new Image_Graphpite_Fill_Gradient(IMAGE_GRAPHPITE_GRAD_RADIAL, IMAGE_GRAPHPITE_RED, IMAGE_GRAPHPITE_WHITE, 200));
$FillArray->add(new Image_Graphpite_Fill_Gradient(IMAGE_GRAPHPITE_GRAD_RADIAL, IMAGE_GRAPHPITE_ORANGE, IMAGE_GRAPHPITE_WHITE, 200));

// output the Graph
$Graph->done();
?>



See http://graphpite.sourceforge.net/ for further details and samples.
» Dependencies » Links
» Timeline » Changelog
  • First Draft: 2004-08-30
  • Proposal: 2004-08-30
  • Call for Votes: 2004-09-07
  • Jesper Veggerby
    [2004-08-31 10:51 UTC]

    Converted class names/include file structure to (hopefully) comply with CS. The private methods/variables still need to be changed.
  • Jesper Veggerby
    [2004-09-01 09:09 UTC]

    Changed private methods and variables to conform with CS. Package *should* now conform to CS. Changed add methods to return reference to object instead of creating global variable. Brush up on code to work with error_reporting E_ALL.
  • Jesper Veggerby
    [2004-09-01 11:21 UTC]

    Changed the file structure. Changed Image_GraPHPite_Parent to Image_GraPHPite_Common. Changed constants to IMAGE_GRAPHPITE_*
  • Jesper Veggerby
    [2004-09-02 09:43 UTC]

    Added updated documentation. Minor package changes.
  • Jesper Veggerby
    [2004-09-03 10:47 UTC]

    Added examples
  • Jesper Veggerby
    [2004-09-06 07:12 UTC]

    Changed Image_GraPHPite -> Image_Graphpite