Gallery - Advanced Glass Bar Chart
Object: bar_glass_value()
- bar_glass_value( $top )
- set_colour( $colour )
- set_tooltip( $tip )
This goes into the <head> of the page:
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
"open-flash-chart.swf", "my_chart",
"550", "450", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/adv-glass.php"} );
</script>
This writes the chart into a div with id="my_chart",
right click and view source to see it in action,
[the tutorials have more details]
gallery/adv-glass.php
<?php
$data_1 = array(); $data_2 = array();
include '../php-ofc-library/open-flash-chart.php';
$data_1[] = 3; $data_1[] = 4;
// // you can add bar_glass_value objects as well as integers // $data_1[] = new bar_glass_value( -5 );
// // make this bar blue // $tmp = new bar_glass_value( 5 ); $tmp->set_colour( '#3030d0' ); $data_1[] = $tmp;
// // make this green and add a tooltip // $tmp = new bar_glass_value( 5 ); $tmp->set_colour( '#30d030' ); $tmp->set_tooltip( 'Data Set 1<br>#top#, #bottom#, #val#' ); $data_1[] = $tmp;
$data_1[] = 9; $data_1[] = 5;
// // second data set // $data_2[] = 1; $data_2[] = 2; $data_2[] = 3; $data_2[] = 4; $tmp = new bar_glass_value( 5 ); $tmp->set_colour( '#d0d030' ); $tmp->set_tooltip( 'Data Set 2<br>#top#, #bottom#, #val#' ); $data_2[] = $tmp; $data_2[] = 6; $data_2[] = 7;
$bar_1 = new bar_glass(); $bar_1->set_values( $data_1 ); $bar_1->colour = '#D54C78';
$bar_2 = new bar_glass(); $bar_2->set_values( $data_2 ); $bar_2->colour = '#78D54C';
$x_axis = new x_axis(); $x_axis->set_3d( 5 ); $x_axis->colour = '#909090'; $x_axis->set_labels( array(1,2,3,4,5,6,7,8,9,10) );
$y_axis = new y_axis(); $y_axis->set_range( -5, 10, 5 );
$chart = new open_flash_chart(); $chart->set_title( new title( date("D M d Y") ) ); $chart->add_element( $bar_1 ); $chart->add_element( $bar_2 ); $chart->set_x_axis( $x_axis ); $chart->set_y_axis( $y_axis );
echo $chart->toPrettyString();
|
|