Chart Elements - Tooltip - Tooltip Clash
A simple little example showing how the tooltips cope when many data points
share the same location.
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/tooltip-clash.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/tooltip-clash.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$data_1 = array(7,6,7,8,8); $data_2 = array(7,8,7,6,6); $data_3 = array(3,4,7,3,3);
$title = new title( date("D M d Y") );
$d = new hollow_dot(); $d->size(5)->halo_size(0)->colour('#3D5C56');
$line_1 = new line(); $line_1->set_default_dot_style($d); $line_1->set_values( $data_1 ); $line_1->set_colour( "#FF0000" ); $line_1->set_width( 2 ); $line_1->set_tooltip("#val#<br>Red [#x_label#]");
$d2 = new hollow_dot(); $d2->size(4)->halo_size(1)->colour('#00FF00');
$line_2 = new line(); $line_2->set_default_dot_style($d2); $line_2->set_values( $data_2 ); $line_2->set_colour( "#00FF00" ); $line_2->set_width( 1 ); $line_2->set_tooltip("#val#<br>Green [#x_label#]");
$d3 = new hollow_dot(); $d3->size(4)->halo_size(1)->colour('#0000FF');
$line_3 = new line(); $line_3->set_default_dot_style($d3); $line_3->set_values( $data_3 ); $line_3->set_colour( "#0000FF" ); $line_3->set_width( 6 ); $line_3->set_tooltip("#val#<br>Blue [#x_label#]");
$y = new y_axis(); $y->set_range( 0, 10, 2 );
$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();
|
|