Gallery - Bar Chart 3D

We at Open flash Chart always strive to make things easy for ourselves. So 3D bar charts have exactly the same parameters as the bar method. The 3D effect is created by shifting the bar colour towards white (#FFFFFF) by about 10%, these two colours are then blended to make the bars look 3D.

Mthod: bar_3D

bar_3D( integer $alpha[, string $colour] [, string $text] [, integer $size] )

See the bar method for details on these parameters.

Mthod: set_x_axis_3d

set_x_axis_3d( $size )

$size is the depth in pixels of the 3D X axis slab.

Note: How making the X axis 3D moves the X axis labels left about 12px. It also creates some padding inside the left of the chart, so the left most bar does not obscure the Y axis.

Using a 3D axis with a line chart will show this inner left padding. Using 3D bars with a normal 2D X axis will show the left most bar obscuring the Y axis. Try experimenting with different options to see what happens.

Create the flash object

<?php
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object750260'http://'$_SERVER['SERVER_NAME'] .'/open-flash-chart/gallery-data-31.php' );
?>
gallery-data-31.php

<?php

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

//
// NOTE: how we are filling 2 arrays full of data,
//       one for each bar on the graph
//
$data_1 = array();
$data_2 = array();
for( 
$i=0$i<10$i++ )
{
  
$data_1[] = rand(2,5);
  
$data_2[] = rand(5,9);
}

include_once( 
'ofc-library/open-flash-chart.php' );
$g = new graph();
$g->title'3D Bar Chart''{font-size:20px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}' );

$g->set_data$data_1 );
$g->bar_3D75'#D54C78''2006'10 );

$g->set_data$data_2 );
$g->bar_3D75'#3334AD''2007'10 );

$g->set_x_axis_3d12 );
$g->x_axis_colour'#909090''#ADB5C7' );
$g->y_axis_colour'#909090''#ADB5C7' );

$g->set_x_labels( array( 'January,February,March,April,May,June,July,August,September,October' ) );
$g->set_y_max10 );
$g->y_label_steps);
$g->set_y_legend'Open Flash Chart'12'#736AFF' );
echo 
$g->render();
?>
To see the data produced : gallery-data-31.php, then 'view source'.