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:
$y can be one of the following strings:
Both $x and $y must be passed as strings, e.g:
$g->set_bg_image( 'http://teethgrinder.co.uk/open-flash-chart/images/logo.png', 'right', 'top' );
or in the following example, the image would be in the middle of the chart:
$g->set_bg_image( 'http://teethgrinder.co.uk/open-flash-chart/images/logo.png', '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
<?php 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' ); ?>
gallery-data-23.php
<?php
// generate some random data srand((double)microtime()*1000000);
$data = array(); $xaxis = array();
for( $i=0; $i<30; $i++ ) { $tmp = rand(5,$i+5); $data[] = $tmp; $xaxis[] = $tmp; }
include_once( '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( 'http://teethgrinder.co.uk/open-flash-chart/images/logo.png', 'right', 'top' ); // //
$g->set_data( $data ); $g->line_hollow( 3, 5, '#7E97A6', 'Fatal kitten attacks in 2007', 10 );
$g->x_axis_colour( '#818D9D', '#ADB5C7' ); $g->y_axis_colour( '#818D9D', '#ADB5C7' );
$g->set_y_max( 40 ); $g->y_label_steps( 8 ); $g->set_y_legend( 'Attacks', 12, '#7E97A6' ); echo $g->render(); ?>
|
|