Open Flash Chart
Support This Project :: Home - Gallery - X Offset
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 - X Offset

Method: set_x_offset

set_x_offset( boolean $val )

By default this is set to true, setting it to false shifts the X axis flush to the Y Axis.

Doing this is for bar charts makes them fall off the edge of the chart, so they look and act a bit weird.

See the scatter chart for another example.

Create the flash object
<?php
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object450300'http://'$_SERVER['SERVER_NAME'] .'/open-flash-chart/gallery-data-45.php' );
?>
gallery-data-45.php
<?php

// generate some random data
srand((double)microtime()*1000000);

//
// NOTE: how we are filling 3 arrays full of data,
//       one for each line on the graph
//
$data_1 = array();
$data_2 = array();
$data_3 = array();
for( 
$i=0$i<12$i++ )
{
  
$data_1[] = rand(14,19);
  
$data_2[] = rand(8,13);
  
$data_3[] = rand(1,7);
}

include_once( 
'ofc-library/open-flash-chart.php' );
$g = new graph();
$g->title'Many data lines''{font-size: 20px; color: #736AFF}' );

// we add 3 sets of data:
$g->set_data$data_1 );
$g->set_data$data_2 );
$g->set_data$data_3 );

// we add the 3 line types and key labels
$g->line2'0x9933CC''Page views'10 );
$g->line_dot35'0xCC3399''Downloads'10);    // <-- 3px thick + dots
$g->line_hollow24'0x80a033''Bounces'10 );

//
// LOOK:
//
$g->set_x_offsetfalse );
//
//
//

$g->set_x_labels( array( 'January','February','March','April','May','June','July','August','Spetember','October','November','December' ) );
$g->set_x_label_style10'0x000000'0);

$g->set_y_max20 );
$g->y_label_steps);
$g->set_y_legend'Open Flash Chart'12'#736AFF' );
echo 
$g->render();
?>
To see the data produced : gallery-data-45.php, then 'view source'.
Help support the project: Support This Project

Adverts: