Chart Elements - Tooltip - Tooltip Hover
Note: how we set the X Axis offset to false so the bars align to the left
correctly.
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",
"400", "250", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/tooltip-hover.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-hover.php
<?php
include_once '../php-ofc-library/open-flash-chart.php';
$x_labels = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
$title = new title( "Total hours on project mayhem" );
$hbar = new hbar( '#86BBEF' ); $hbar->set_tooltip( 'Months: #val#' ); $hbar->set_values( array(4,8,3,4,7,8) );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $hbar );
$x = new x_axis(); $x->set_offset( false ); $x->set_range( 0, 10 ); //$x->set_labels_from_array( $x_labels ); $chart->set_x_axis( $x );
$y = new y_axis(); $y->set_offset( true ); $y->set_labels( array( "Jeff","Geoff","Bob","Terry","Duncan","monk.e.boy" ) ); $chart->add_y_axis( $y );
$tooltip = new tooltip(); // // LOOK: // $tooltip->set_hover(); // // // $tooltip->set_stroke( 1 ); $tooltip->set_colour( "#000000" ); $tooltip->set_background_colour( "#ffffff" ); $chart->set_tooltip( $tooltip );
echo $chart->toPrettyString();
|
Adverts:
|