|
|
Charts - Pie Charts - Pie Chart
Make a pie chart.
Documentation:
This goes into the <head> of the page:
<script type="text/javascript" src="js/jquery-1.2.6.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-personalized-1.6rc2.min.js"></script>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
"open-flash-chart.swf", "my_chart",
"100%", "100%", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/pie-chart-fixed-radius.php"} );
$(document).ready(function(){
$("#resize").resizable();
});
</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-fixed-radius.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( 'Current use of contraception' ); $title->set_style('color: #f0f0f0; font-size: 20px');
$d = array( new pie_value(0, "Spermicides"), new pie_value(1, "Safe period"), new pie_value(1, "Cap"), new pie_value(3, "Injection"), new pie_value(4, "Withdrawal"), new pie_value(5, "IUD"), new pie_value(19, "Condom"), new pie_value(21, "Sergical"), new pie_value(21, "None"), new pie_value(27, "Pill") );
$pie = new pie(); $pie->alpha(0.5) ->add_animation( new pie_fade() ) ->start_angle( 0 ) ->tooltip( 'Radius: #radius#' ) ->colours(array("#d01f3c","#356aa0","#C79810")) ->values( $d ) ->radius(50);
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $pie ); $chart->set_bg_colour('#202020');
echo $chart->toPrettyString();
|
Adverts:
|
|