Chart Elements - Title
House prices in Cornwall
Loading message
You can change the 'Loading...' message by passing a varibale to the chart when
you create it, take a look at the Javascript below.
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/loading.php","loading":"Customise the loading message..."} );
</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/loading.php
<?php
sleep( 5 );
include '../php-ofc-library/open-flash-chart.php';
$title = new title( "Avg. Price of Detached Property in the South West, UK" );
$data = array(); $data[] = 95089; $data[] = 97097; $data[] = 98388; $data[] = 96468; $data[] = 94596; $data[] = 98313; $data[] = 102700; $data[] = 101919; $data[] = 104891; $data[] = 108200; $data[] = 111455; $data[] = 114275; $data[] = 115664; $data[] = 120490; $data[] = 123912; $data[] = 120839; $data[] = 123585; $data[] = 125851; $data[] = 135612; $data[] = 141432; $data[] = 149183; $data[] = 157705; $data[] = 169596; $data[] = 168963; $data[] = 165272; $data[] = 175186; $data[] = 186065; $data[] = 185857; $data[] = 190862; $data[] = 203400; $data[] = 222692; $data[] = 234415; $data[] = 242485; $data[] = 246070; $data[] = 261588; $data[] = 259651; $data[] = 266573; $data[] = 274176;
$x = array(); $x[] = '1/1995';
$x[] = '2/1995'; $x[] = '3/1995'; $x[] = '4/1995'; $x[] = '1/1996'; $x[] = '2/1996'; $x[] = '3/1996'; $x[] = '4/1996'; $x[] = '1/1997'; $x[] = '2/1997'; $x[] = '3/1997'; $x[] = '4/1997'; $x[] = '1/1998'; $x[] = '2/1998'; $x[] = '3/1998'; $x[] = '4/1998'; $x[] = '1/1999'; $x[] = '2/1999'; $x[] = '3/1999'; $x[] = '4/1999'; $x[] = '1/2000'; $x[] = '2/2000'; $x[] = '3/2000'; $x[] = '4/2000'; $x[] = '1/2001'; $x[] = '2/2001'; $x[] = '3/2001'; $x[] = '4/2001'; $x[] = '1/2002'; $x[] = '2/2002'; $x[] = '3/2002'; $x[] = '4/2002'; $x[] = '1/2003'; $x[] = '2/2003'; $x[] = '3/2003'; $x[] = '4/2003'; $x[] = '1/2004'; $x[] = '2/2004';
$bar = new bar_filled( '#E2D66A', '#577261' ); $bar->set_on_show(new bar_on_show('grow-up', 2.5, 0)); $bar->set_values( $data ); $bar->set_tooltip( "UK Pounds #val#" );
$x_labels = new x_axis_labels(); $x_labels->set_vertical(); $x_labels->set_labels( $x );
$x_axis = new x_axis(); $x_axis->set_labels( $x_labels );
$y = new y_axis(); $y->set_range( 0, 300000, 10000 );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $bar ); $chart->set_bg_colour( '#FFFFFF' ); $chart->set_x_axis( $x_axis ); $chart->set_y_axis( $y );
echo $chart->toPrettyString();
|
|