Chart Elements - Y Axis Menu - Magic variables
Set the default text for the labels. The magic value #val# gets replaced with the
numeric value of that point.
Note that the number is formatted using the locale settings before it is inserted into
the label.
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", "260", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/y-axis-format-2.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-format-2.php
<?php
include '../php-ofc-library/open-flash-chart.php';
$title = new title( date("D M d Y") );
$data = array(); for( $i=0; $i<10; $i++) $data[] = rand(100000, 900000);
$bar = new bar_rounded_glass(); $bar->set_values( $data );
$chart = new open_flash_chart(); $chart->set_title( $title ); $chart->add_element( $bar );
// // create a Y Axis object // $y = new y_axis(); $y->set_range(0, 1000000, 100000); $y->set_label_text( "$#val# million" ); $chart->set_y_axis( $y ); $chart->set_number_format(2, true, true, true );
echo $chart->toPrettyString();
|
|