Gallery - Data
Add different data to the graph.
The chart will automatically resize all of the elements to fit the large key.
Method: set_data()
set_data( array $data )
Method: line()
line( int $line_width, string $colour, string $key_text[, int $size] )
Draws a line. This does not have tool tips. This is a bug, and at the moment I'm not sure if it needs fixing.
Method: line_dot()
line_dot( int $line_width, int $dot_size, string $colour, string $key_text[, int $key_size] )
Method: line_hollow()
line_hollow( int $line_width, int $circle_size, string $colour, string $key_text[, int $key_size] )
To add more than one line of data to the graph, call the method set_data() with each line of data. Then set the line style with line()
For details of how we changed the key text styles, see Line and Key.
Create the flash object
<?php include_once 'ofc-library/open_flash_chart_object.php'; open_flash_chart_object( 450, 300, 'http://'. $_SERVER['SERVER_NAME'] .'/open-flash-chart/gallery-data-13.php' ); ?>
gallery-data-13.php
<?php
// generate some random data srand((double)microtime()*1000000);
// // NOTE: how we are filling 3 arrays full of data, // one for each line on the graph // $data_1 = array(); $data_2 = array(); $data_3 = array(); for( $i=0; $i<12; $i++ ) { $data_1[] = rand(14,19); $data_2[] = rand(8,13); $data_3[] = rand(1,7); }
include_once( 'ofc-library/open-flash-chart.php' ); $g = new graph(); $g->title( 'Many data lines', '{font-size: 20px; color: #736AFF}' );
// we add 3 sets of data: $g->set_data( $data_1 ); $g->set_data( $data_2 ); $g->set_data( $data_3 );
// we add the 3 line types and key labels $g->line( 2, '0x9933CC', 'Page views', 10 ); $g->line_dot( 3, 5, '0xCC3399', 'Downloads', 10); // <-- 3px thick + dots $g->line_hollow( 2, 4, '0x80a033', 'Bounces', 10 );
$g->set_x_labels( array( 'January','February','March','April','May','June','July','August','Spetember','October','November','December' ) ); $g->set_x_label_style( 10, '0x000000', 0, 2 );
$g->set_y_max( 20 ); $g->y_label_steps( 4 ); $g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' ); echo $g->render(); ?>
|
Help support the project:
|