|
|
Chart Elements - X Axis Labels
Object: x_axis
Methods:
- set_labels_from_array( $a )
Takes an array of strings. These are the labels you want to display.
This goes into the <head> of the page:
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
"open-flash-chart.swf", "my_chart",
"550", "400", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/x-axis-labels.php"} );
</script>
This writes the chart into a div with id="my_chart",
right click and view source to see it in action,
[the tutorials have more details]
gallery/x-axis-labels.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( 'X Axis Labels' );
$line_dot = new line(); $line_dot->set_values( array(9,8,7,6,5,4,3,2,1) );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $line_dot );
// // create an X Axis object // $x = new x_axis(); $x->set_colour( '#428C3E' ); $x->set_grid_colour( '#86BF83' ); // // we add a label to every X location // $x->set_labels_from_array( array( 'one','two','three','four','five','six','seven','eight','nine' ) );
// // Add the X Axis object to the chart: // $chart->set_x_axis( $x );
echo $chart->toPrettyString();
|
Adverts:
|
|