/** * Creates a bar chart from random data * */ public function execute3DBarChartData() { //Create new stBar3D object and set the transparency and colour. $redBar = new stBar3D(75, '#d01f3c'); $redBar->key('2007', 10); //random data for ($i = 0; $i < 12; $i++) { $redBar->data[] = rand(200, 500); } //2nd Bar $blueBar = new stBar3D(75, '#356aa0'); $blueBar->key('2008', 10); //random data for 2nd bar for ($i = 0; $i < 12; $i++) { $blueBar->data[] = rand(200, 500); } $g = new stGraph(); $g->bg_colour = '#E4F5FC'; $g->title('Number of downloads in 2008 and 2009', '{font-size:20px; color: #18A6FF;}'); $g->data_sets[] = $redBar; $g->data_sets[] = $blueBar; //to create 3d x-axis $g->set_x_axis_3d(10); $g->x_axis_colour('#8499A4', '#E4F5FC'); $g->y_axis_colour('#8499A4', '#E4F5FC'); $g->set_x_labels(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')); $g->set_y_max(500); $g->y_label_steps(5); $g->set_y_legend('stOfcPlugin', 12, '#18A6FF'); echo $g->render(); return sfView::NONE; }