It is easy to mix bar and lines on one graph. To display a set of data as a line, call
the line() method. To display a set of data as a bar call
the bar() method.
The order in which you call these methods determins which is on top, Open Flash Chart will
display the first set of data (either a line or bar), then display the next data set on top
of the first.
The order in which you pass the sets of data to Open Flash Chart also effects the order they
are displayed in the key.
// generate some random data srand((double)microtime()*1000000);
// // NOTE: how we are filling 3 arrays full of data, // one for each line on the graph // $data_1 = array(); $data_2 = array(); $data_3 = array(); for( $i=0; $i<9; $i++ ) { $data_1[] = rand(2,5); $data_2[] = rand(4,7); $data_3[] = rand(5,9); }
include_once( 'ofc-library/open-flash-chart.php' ); $g = new graph(); $g->title( 'Mixed Line and Bar Charts', '{font-size: 35px; color: #800000}' );