|
Note: this chart is a scatter line chart.
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/line-step.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/line-step.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( date("D M d Y") );
$line_1 = new scatter_line('#ff0000', 3); $line_1->set_values( array( new scatter_value(1, 1), new scatter_value(2, 2), new scatter_value(3, 1) )); $line_1->set_key( 'No step', 10 );
$line_2 = new scatter_line('#6D8F47', 3); $line_2->set_values( array( new scatter_value(4, 1), new scatter_value(5, 2), new scatter_value(6, 1) )); $line_2->set_step_horizontal(); $line_2->set_key( 'Step horizontal', 10 );
$line_3 = new scatter_line('#7F6547', 3); $line_3->set_values( array( new scatter_value(7, 1), new scatter_value(8, 2), new scatter_value(9, 1) )); $line_3->set_step_vertical(); $line_3->set_key( 'Step vertical', 10 );
$y = new y_axis(); $y->set_range( 0, 5 );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $line_1 ); $chart->add_element( $line_2 ); $chart->add_element( $line_3 ); $chart->set_y_axis( $y );
echo $chart->toPrettyString();
|
Adverts:
|