1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
// create the graph
$Graph =& Image_Graph::factory('graph', array(800, 350));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
$Graph->add(
Image_Graph::vertical(
Image_Graph::factory('title', array($_GET["name"], 12)),
Image_Graph::vertical(
$Plotarea = Image_Graph::factory('plotarea'),
$Legend = Image_Graph::factory('legend'),
90
),
5
)
);
$GridY2 =& $Plotarea->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y_SECONDARY);
$GridY2->setFillStyle(
Image_Graph::factory(
'gradient',
array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'lightgrey')
)
);
// create the dataset
$Dataset = &Image_Graph::factory('dataset');
for($i=0;$i<count($arrayGraph);$i++){
$Dataset->addPoint($arrayGraph[$i]["formdate"], $arrayGraph[$i]["valeur"]);
}
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisX->setFontAngle('vertical');
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY->setTitle('Prix en Pc', 'vertical');
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Smoothed_Area', array(&$Dataset));
// set a line color
$Plot->setLineColor('gray');
// set a standard fill style
$Plot->setFillColor('blue@0.2');
// output the Graph
$Graph->done(); |
Partager