|
Make a bar chart.
Documentation: bar sketch,
inherits from bar_base.
The only interesting parameter is the $fun_factor.
0,1 and 2 are pretty boring. 4 to 6 is a bit fun, 7 and above is lots of fun.
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", "200", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/sketch-bar-chart.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/sketch-bar-chart.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( date("D M d Y") ); $title->set_style( '{color: #567300; font-size: 14px}' );
$data=array();
for( $i=0; $i<12; $i++) { if(rand(1,10)<7) $data[] = $i; // <-- append a number else { // append a bar_value object to the data array $bar = new bar_value(3); $bar->set_tooltip( 'Hello<br>#val#' ); $data[] = $bar; } }
$bar = new bar_sketch( '#81AC00', '#567300', 5 ); $bar->set_values( $data );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $bar );
echo $chart->toPrettyString();
|
Adverts:
|