Open Flash Chart
Support This Project :: Home - Gallery - Background Image
Info: Open Flash Chart 2 is out. Version 1.x and these pages will never disappear and the charts will continue working forever, but further development on 1.x has stopped. Take a look at version 2 here Open Flash Chart 2.

Gallery - Background Image

Method: set_bg_image()

set_bg_image( string $url[, string $x][, string $y] )
$url, the image URL.
$x can be one of the following strings:
  • center
  • left
  • right
$y can be one of the following strings:
  • middle
  • top
  • bottom
Both $x and $y must be passed as strings, e.g:
$g->set_bg_image( '', 'right', 'top' );
or in the following example, the image would be in the middle of the chart:
$g->set_bg_image( '', 'center', 'middle' );

Tip: Don't forget that you can edit your image to have a 20 pixel blank border around it so it is not 'squished' up against the edge of the chart.

Create the flash object
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object'100%'200'http://'$_SERVER['SERVER_NAME'] .'/open-flash-chart/gallery-data-23.php' );

// generate some random data

$data = array();
$xaxis = array();

$i=0$i<30$i++ )
$tmp rand(5,$i+5);
$data[] = $tmp;
$xaxis[] = $tmp;

'ofc-library/open-flash-chart.php' );
$g = new graph();
$g->title'Background Image''{font-size: 30px; color: #7E97A6}' );

$g->bg_colour '#E2E6E0';

$g->set_bg_image'''right''top' );

$g->set_data$data );
$g->line_hollow35'#7E97A6''Fatal kitten attacks in 2007'10 );

$g->x_axis_colour'#818D9D''#ADB5C7' );
$g->y_axis_colour'#818D9D''#ADB5C7' );

$g->set_y_max40 );
$g->set_y_legend'Attacks'12'#7E97A6' );
To see the data produced : gallery-data-23.php, then 'view source'.
Help support the project: Support This Project