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

Method: set_x_labels()

set_x_labels( $a )
$a array of strings to label each value of set_data( $a ).

Method: set_x_tick_size()

set_x_tick_size( $size )
$size of X axis label ticks in pixels.

Method: set_x_label_style()

set_x_label_style( int $size[, string $colour=''] [, integer $orientation] [, integer $step] [, string $grid_colour] )
$size integer, size in pixels of the X axis ticks.
$colour string, text colour.
$orientation integer, see X Axis Labels Orientation.
$step integer, see X Axis Labels Step.
$grid_colour, see X Axis Labels Step.

Method: set_x_axis_steps()

set_x_axis_steps( integer $step )
$step integer, see X Axis Labels Step.

The chart elements will resize themselves to accomodate the X axis labels.


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

gallery-data-8.php
<?php

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

$tmp = array();
for( 
$i=0$i<5$i++ )
{
  
$tmp[] = rand(1,9);
}

include_once( 
'ofc-library/open-flash-chart.php' );
$g = new graph();
$g->set_data$tmp );
$g->set_x_tick_size15 );
$g->set_x_labels( array('Mon','Tue','Wed','Thur','Fri') );
$g->set_x_label_style25'#9933CC' );
$g->set_y_max10 );
$g->line2'0x9933CC' );
$g->title'Server load''{font-size: 25px; color: #9933CC; text-align: right}' );
echo 
$g->render();
?>
To see the data produced : gallery-data-8.php, then 'view source'.

Remove X Axis Labels

In the next example I have removed X axis labels, by not calling the set_x_labels() method. The graph was made wider and the x_axis_tick_size() was set to 10 pixels.


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

gallery-data-9.php
<?php

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

$max 10;
$tmp = array();
for( 
$i=0$i<25$i++ )
{
  
$tmp[] = rand(0,$max);
}

include_once( 
'ofc-library/open-flash-chart.php' );
$g = new graph();
$g->set_data$tmp );
$g->set_y_max$max );
$g->line2'#9933CC' );
$g->set_x_tick_size10 );
$g->title'Server load''{font-size: 25px; color: #9933CC; text-align: left}' );
echo 
$g->render();
?>
To see the data produced : gallery-data-9.php, then 'view source'.
Help support the project: Support This Project

Adverts: