Gallery - Bar Chart
Make a bar chart.
Object: bar()
- set_values( $v )
An array of values. Each value can be a number, a bar_value or a null value.
- append_value( $v )
Appends a value (see set_values for details)
- set_key( $text, $size )
- set_colour( $colour )
- set_alpha( $alpha )
To add more than one set of bars to a bar chart, see bar chart 2.
For details of how we changed the key text styles, see Line and Key.
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/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/bar-chart.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( date("D M d Y") );
$bar = new bar(); $bar->set_values( array(9,8,7,6,5,4,3,2,1) );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $bar );
echo $chart->toPrettyString();
|
|