Warning this is an old version.

Take me to the latest version

Charts - Bar Charts Menu - Floating Bars

Make a bar chart.

See bar chart for details on the bar object.

This example shows how to use the bar_value object and the null value.

Note how the tooltip magic value #val# is the height of the bar (top-bottom) for all bars. Use #top# to get the top value and #bottom# to get the bottom value, or just set the tip text to anything you want.

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", "400", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/adv-floating-bars.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-floating-bars.php
<?php

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

$data = array();
$data[] = new bar_filled_value(6,2);
$data[] = new bar_filled_value(7,2);
$data[] = new bar_filled_value(10,3);
$data[] = new bar_filled_value(13,6);
$tmp = new bar_filled_value(17,8);
$tmp->set_colour'#FF00FF' );
$tmp->set_outline_colour'#900090' );
$tmp->set_tooltip'Custom tooltip<br>max (top):#top#<br>min (bottom):#bottom#<br>Value:#val#' );
$data[] = $tmp;
$data[] = new bar_filled_value(20,12);
$data[] = new bar_filled_value(22,14);
$data[] = new bar_filled_value(21,13);
$data[] = new bar_filled_value(19,11);
$data[] = new bar_filled_value(14,8);
$data[] = new bar_filled_value(10,5);
$data[] = new bar_filled_value(7,4);

$bar = new bar_filled();
$bar->set_values$data );
$bar->set_colour'#FFEF3F' );
$bar->set_tooltip'#x_label#<br>#bottom# - #top#<br>Temp. range:#val#\'C' );

$y = new y_axis(); 
$y->set_range030);

$x = new x_axis();
$x->set_labels_from_array( array('Jan','Feb','March','April','May','June','July','Aug','Sept','Oct','Nov','Dec' ) );

$chart = new open_flash_chart();
$chart->set_title( new title"Average Monthly Temperature for the UK" ) );
$chart->add_element$bar );
$chart->set_bg_colour'#FFFFFF' );
$chart->set_y_axis$y );
$chart->set_x_axis$x );


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


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