Chart Elements - Y Axis Menu - Style each Y label
Documentation: y_axis,
y_axis_base
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/y-axis-style-each-label.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/y-axis-style-each-label.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( date("D M d Y") );
$line_dot = new line(); $line_dot->set_values( array(50,50,50) );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $line_dot );
// // create a Y Axis object // $y = new y_axis(); $y->set_stroke( 2 ); $y->set_colour( '#D7E4A3' ); $y->set_tick_length( 3 ); $y->set_grid_colour( '#A2ACBA' ); $y->set_range(0, 100, 10);
// label every 10% point: $labels = array(); for($y_pos=0; $y_pos<91; $y_pos+=10) $labels[] = new y_axis_label($y_pos, "$y_pos%"); $one_hundred = new y_axis_label(100, "100%"); $one_hundred->set_colour('#FF59AF'); $one_hundred->set_size(18); $labels[] = $one_hundred;
$bag = new y_axis_labels(); $bag->set_labels( $labels ); $bag->set_colour( '#F57B11' ); $bag->set_size( 16 );
$y->set_labels( $bag );
// // Add the Y Axis object to the chart: // $chart->set_y_axis( $y );
echo $chart->toPrettyString();
|
|