// Standard comprehensions
Include ("pChart/pData. class ");
Include ("pChart/pChart. class ");
// Dataset definition
$ DataSet = new pData;
// Chart data
$ DataSet-> AddPoint (array (,-3,-3, 3, 4), "Serie1 ");
$ DataSet-> AddPoint (array (,-, 3), "Serie2 ");
$ DataSet-> AddPoint (array (, 2,-1,-4,-,), "Serie3 ");
$ DataSet-> AddAllSeries ();
$ DataSet-> SetAbsciseLabelSerie ();
// Data legend
$ DataSet-> SetSerieName ("Microsoft", "Serie1 ");
$ DataSet-> SetSerieName ("IBM", "Serie2 ");
$ DataSet-> SetSerieName ("Google", "Serie3 ");
// Initialise the graph
$ Test = new pcharts (700,230 );
// Set the chart size and style
$ Test-> setFontProperties ("Fonts/tahoma. ttf", 8 );
$ Test-> setGraphArea (680,200, 30 );
$ Test-> drawFilledRoundedRectangle (693,223, 5,240,240,240 );
$ Test-> drawRoundedRectangle (695,225, 5,230,230,230 );
$ Test-> drawGraphArea (255,255,255, TRUE );
$ Test-> drawScale ($ DataSet-> GetData (), $ DataSet-> getdatadeworkflow (), SCALE_NORMAL, 150,150,150, TRUE, TRUE );
$ Test-> drawGrid (4, TRUE, 230,230,230, 50 );
// Draw the 0 line
$ Test-> setFontProperties ("Fonts/MankSans. ttf", 6 );
$ Test-> drawTreshold (0,143, 72, TRUE, TRUE );
// Draw the bar graph
// Use drawBarGraph () for the column chart ()
$ Test-> drawBarGraph ($ DataSet-> GetData (), $ DataSet-> getdatadeworkflow (), TRUE, 80 );
// Finish the graph
// Create attributes such as Legend, title, and font
$ Test-> setFontProperties ("Fonts/MankSans. ttf", 10 );
$ Test-> drawLegend (596,150, $ DataSet-> getdatadeworkflow (), 255,255,255 );
$ Test-> setFontProperties ("Fonts/MankSans. ttf", 10 );
$ Test-> drawTitle (50, 22, "Example", 50, 50, 50,585 );
// Generate a chart
$ ImageFile = "example12.png ";
$ Test-> Render ($ imageFile );
Echo '';
?> |