Info: Open Flash Chart 2 is out. Version 1.x and these pages will
never disappear and the charts will continue working forever, but further
development on 1.x has stopped. Take a look at version 2 here
Open Flash Chart 2.
Gallery - Bar + Line Chart
Mix bars and lines on one chart.
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}' );