|
Make an area chart.
Documentation: area_hollow,
inherits from area_line.
See the area hollow for details on the methods
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", "400", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/area-on-show-animation.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/area-on-show-animation.php
<?php
$data = array();
for( $i=0; $i<22; $i+=0.2 ) { $tmp = sin($i)*1.9 + 3; $data[] = $tmp; }
include '../php-ofc-library/open-flash-chart.php';
$chart = new open_flash_chart(); $chart->set_title( new title( 'Area Chart' ) );
// // Make our area chart: // $d = new dot(); $d->colour('#9C0E57')->size(3);
$area = new area(); // set the circle line width: $area->set_width( 2 ); $area->set_default_dot_style($d); $area->set_colour( '#C4B86A' ); $area->set_fill_colour( '#C4B86A' ); $area->set_fill_alpha( 0.7 ); $area->on_show(new line_on_show('pop-up', 2, 0.5)); $area->set_values( $data );
// add the area object to the chart: $chart->add_element( $area );
$y_axis = new y_axis(); $y_axis->set_range( 0, 8, 2 ); $y_axis->labels = null; $y_axis->set_offset( false );
$x_axis = new x_axis(); $x_axis->labels = $data; $x_axis->set_steps( 2 );
$x_labels = new x_axis_labels(); $x_labels->set_steps( 4 ); $x_labels->set_vertical(); // Add the X Axis Labels to the X Axis $x_axis->set_labels( $x_labels );
$chart->add_y_axis( $y_axis ); $chart->x_axis = $x_axis;
echo $chart->toPrettyString();
|
Adverts:
|