Charts - Pie Charts - Pie Chart
Make a pie chart.
Object: pie()
Object: pie_value( $value, $label )
- set_colour( $colour )
- set_label( $label, $label_colour, $font_size )
Note: see the advanced pie chart tutorial
on how to customize individual pie slices, change fonts, alter colours and add
gradient colours.
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",
"300", "300", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/pie-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/pie-chart.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( 'Pork Pie, Mmmmm' );
$pie = new pie(); $pie->set_start_angle( 35 ); $pie->set_animate( true ); $pie->set_tooltip( '#val# of #total#<br>#percent# of 100%' ); $pie->set_values( array(2,3,new pie_value(6.5, "hello (6.5)")) );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $pie );
$chart->x_axis = null;
echo $chart->toPrettyString();
|
Adverts:
|