Gallery - Advanced 3D Bar Chart
Object: bar_3d_value()
- bar_3d_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-3d.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-3d.php
<?php
$data = array();
include '../php-ofc-library/open-flash-chart.php';
$data[] = -3; $data[] = 4;
// // you can add bar_3d_value objects as well as integers // $data[] = new bar_3d_value( -5 );
// // make this bar blue // $tmp = new bar_3d_value( 5 ); $tmp->set_colour( '#3030d0' ); $data[] = $tmp;
// // make this green and add a tooltip // $tmp = new bar_3d_value( -10 ); $tmp->set_colour( '#30d030' ); $tmp->set_tooltip( 'Hello<br>#top#, #bottom#, #val#' ); $data[] = $tmp;
$data[] = 9; $data[] = 5;
$bar = new bar_3d(); $bar->set_values( $data ); $bar->colour = '#D54C78';
$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( -10, 10, 5 );
$chart = new open_flash_chart(); $chart->set_title( new title( date("D M d Y") ) ); $chart->add_element( $bar ); $chart->set_x_axis( $x_axis ); $chart->set_y_axis( $y_axis );
echo $chart->toPrettyString();
|
|