Open Flash Chart
Support This Project :: Home - Gallery - Line - On Click Events
Info: Open Flash Chart 2 is out. Version 1.x and these pages will never disappear and the charts will continue working forever, but further development on 1.x has stopped. Take a look at version 2 here Open Flash Chart 2.

Gallery - Line - On Click Events

Add click events to the data points

Method: set_links( array $links )

You can use either javascript code or normal URLs as a link.

Points that have an onclick event (they have a link set) will turn the mouse to a hand pointer and will pulse to indecate something will happen if you click on them.

Create the flash object
include_once 'ofc-library/open_flash_chart_object.php';
open_flash_chart_object500300'http://'$_SERVER['SERVER_NAME'] .'/open-flash-chart/gallery-data-49.php' );

include_once( 'ofc-library/open-flash-chart.php' );

// generate some random data

$x_labels = array( 'January','February','March','April','May','June','July','August','Spetember','October','November','December' );

$line_1 = new line2'#9933CC' );
$line_1->key'Page views'10 );

$line_2 = new line_hollow24'#80a033' );
$line_2->key'Bounces'10 );

$i=0$i<12$i++ )
$tmp rand(14,19);  // <-- we need to remember this value for the onClick
$line_1->add_link$tmp'javascript:alert("Downloads, '$x_labels[$i] .' = '$tmp .'")' );
$tmp rand(2,10);
$line_2->add_link$tmp'javascript:alert("Bounces, '$x_labels[$i] .' = '$tmp .'")' );

$g = new graph();
$g->title'Many data lines''{font-size: 20px; color: #736AFF}' );

$g->data_sets[] = $line_1;
$g->data_sets[] = $line_2;

$g->set_x_labels$x_labels );

$g->set_y_max20 );
$g->set_y_legend'Open Flash Chart'12'#736AFF' );
To see the data produced : gallery-data-49.php, then 'view source'.
Help support the project: Support This Project