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_object ( 350 , 150 , '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_size ( 15 ); $g -> set_x_labels ( array( 'Mon' , 'Tue' , 'Wed' , 'Thur' , 'Fri' ) ); $g -> set_x_label_style ( 25 , '#9933CC' ); $g -> set_y_max ( 10 ); $g -> line ( 2 , '0x9933CC' ); $g -> title ( 'Server load' , '{font-size: 25px; color: #9933CC; text-align: right}' ); echo $g -> render (); ?>
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_object ( 500 , 150 , '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 -> line ( 2 , '#9933CC' ); $g -> set_x_tick_size ( 10 ); $g -> title ( 'Server load' , '{font-size: 25px; color: #9933CC; text-align: left}' ); echo $g -> render (); ?>
Help support the project:
Adverts: