|
Add different data to the graph.
Each dot gets its attributes from the line settings. For example, setting:
$line_dot->set_dot_size( 3 );
actually sets each dots size attribute to 3. You can override these using
dot_value( $value, $colour ) (search the PHP source code to see the methods
avaible in this object)
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/adv-line-dot.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/adv-line-dot.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$data = array(); for( $i=0; $i<8; $i+=0.2 ) { $val = sin($i) + 1.5; // // OK, lets do something interesting. // any value above 1.75 we will plot // in RED // if( $val > 1.75 ) { $d = new dot($val); $data[] = $d->colour('#D02020')->tooltip('#val#<br>Your text here'); } else $data[] = $val; }
$default_dot = new dot(); $default_dot->size(3)->colour('#DFC329')->tooltip( '#x_label#:#val#' );
$line_dot = new line(); $line_dot->set_default_dot_style($default_dot); $line_dot->set_width( 2 ); $line_dot->set_colour( '#DFC329' ); $line_dot->set_values( $data );
$y = new y_axis(); $y->set_range( 0, 3, 1 );
$chart = new open_flash_chart(); $chart->set_title( new title( 'Advanced dot lines' ) ); $chart->set_y_axis( $y ); // // here we add our data sets to the chart: // $chart->add_element( $line_dot );
echo $chart->toPrettyString();
|
|