Warning this is an old version.

Take me to the latest version

Chart Elements - X Axis Menu - X Axis Labels

Documentation: x_axis

Note how the times in the X axis go all the way up past 28:00 (lol)

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", "200", "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' );

$d = array();
$labels = array();
$velocity 0;
$gravity 0.8;
$bounce 0.85;
$y 10;

for(
$i=0$i<30$i++)
{
    
$velocity += $gravity;
    
    
$y -= $velocity;
    
    if( 
$y 0)
    {
        
$y 0;
        
$velocity *= -$bounce;
    }
    
$d[] = $y;
    
$labels[] = sprintf('%02d:00'$i);
}

$hol = new hollow_dot();
$hol->size(3)->halo_size(1)->tooltip('#x_label#<br>#val#');

$line = new line();
$line->set_default_dot_style($hol); 
$line->set_values$d );

$chart = new open_flash_chart();
$chart->set_title$title );
$chart->add_element$line );

//
// create an X Axis object
//
$x = new x_axis();
$x->set_colour'#428C3E' );
$x->set_grid_colour'#86BF83' );
$x->steps(4);
//
// we add a label to every X location
//
$x->set_labels_from_array($labels);



//
// Add the X Axis object to the chart:
//
$chart->set_x_axis$x );

echo 
$chart->toPrettyString();
To see the data produced : gallery/x-axis-labels.php, then 'view source'.
Support This Project
Adverts:


Open Flash Chart logo by numb.me.uk. | Syntax highlights are by GeSHi