|
See the area charts for more details on the area object.
The default tooltip is of no use with radar charts so we change its behaviour to
proximity.
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", "350", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/radar-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/radar-chart.php
<?php
include '../php-ofc-library/open-flash-chart.php'; // also include the sugar (helper funtions) include '../php-ofc-library/ofc_sugar.php';
$chart = new open_flash_chart(); $chart->set_title( new title( 'Radar Chart' ) );
$area = new area(); // set the circle line width: $area->set_width( 1 ); $area->set_default_dot_style( new s_hollow_dot('#45909F', 5) ); $area->set_colour( '#45909F' ); $area->set_fill_colour( '#45909F' ); $area->set_fill_alpha( 0.4 ); $area->set_loop(); $area->set_values(array(3, 4, 5, 4, 3, 3, 2.5));
// add the area object to the chart: $chart->add_element( $area );
$r = new radar_axis( 5 );
$r->set_colour( '#EFD1EF' ); $r->set_grid_colour( '#EFD1EF' );
$labels = new radar_axis_labels( array('0','1','2','3','4','5') ); $labels->set_colour( '#9F819F' ); $r->set_labels( $labels );
$chart->set_radar_axis( $r );
$tooltip = new tooltip(); $tooltip->set_proximity(); $chart->set_tooltip( $tooltip );
$chart->set_bg_colour( '#DFFFEC' );
echo $chart->toPrettyString();
|
|