source: code/Website/php5-ofc-library/examples/stacked-bar-chart.php@ 7849

Last change on this file since 7849 was 7849, checked in by dennisw, 15 years ago
File size: 720 bytes
Line 
1<?php
2
3require_once('OFC/OFC_Chart.php');
4
5$title = new OFC_Elements_Title( date("D M d Y") );
6
7$bar_stack = new OFC_Charts_Bar_Stack();
8$bar_stack->append_stack( array( 2.5, 5 ) );
9$bar_stack->append_stack( array( 7.5 ) );
10$bar_stack->append_stack( array( 5, new OFC_Charts_Bar_Stack_Value(5, '#ff0000') ) );
11$bar_stack->append_stack( array( 2, 2, 2, 2, new OFC_Charts_Bar_Stack_Value(2, '#ff00ff') ) );
12
13$y = new OFC_Elements_Axis_Y();
14$y->set_range( 0, 14, 7 );
15
16$x = new OFC_Elements_Axis_X();
17$x->set_labels( array( 'a', 'b', 'c', 'd' ) );
18
19$chart = new OFC_Chart();
20$chart->set_title( $title );
21$chart->add_element( $bar_stack );
22$chart->set_x_axis( $x );
23$chart->add_y_axis( $y );
24
25echo $chart->toPrettyString();
Note: See TracBrowser for help on using the repository browser.