Charts - Scatter charts - Scatter Line Chart

Documentation: scatter_line

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",
"600", "400", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/scatter-line-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/scatter-line-chart.php
<?php

include '../php-ofc-library/open-flash-chart.php';

$chart = new open_flash_chart();

$title = new titledate("D M d Y") );
$chart->set_title$title );

$s = new scatter_line'#DB1750');
$def = new hollow_dot();
$def->size(3)->halo_size(2);
$s->set_default_dot_style$def );
$v = array();

$x 0.0;
$y 0;
do
{
    
$v[] = new scatter_value$x$y );

    
// move up or down in Y axis:
    
$y += rand(-2020)/10;
    if( 
$y 10 )
        
$y 10;
        
    if( 
$y < -10 )
        
$y = -10;
    
    
$x += rand(515)/10;
}
while( 
$x 25 );

$s->set_values$v );
$chart->add_element$s );

$x = new x_axis();
$x->set_range025 );
$chart->set_x_axis$x );

$y = new x_axis();
$y->set_range( -1010 );
$chart->add_y_axis$y );


echo 
$chart->toPrettyString();
To see the data produced : gallery/scatter-line-chart.php, then 'view source'.
Support This Project
Adverts:


Open Flash Chart logo by numb.me.uk. | Syntax highlights are by GeSHi