Gallery - Candle
Method: candle
candle( array $data, integer $alpha, integer $line_width, string $colour, [, string $text] [, integer $size] )
The data array must be an array of candle objects.
candle( integer $high, integer $open, integer $close, integer $low )
The candle object take four parameters, high, open, close and low. The candle is hollow if it opens higher than it closes.
Note:
The candle adds extra magic options to the tooltip string:
- #high#
- #open#
- #low#
- #close#
I assume you can figure out what those magic values get replaced with :-)
Create the flash object
<?php include_once 'ofc-library/open_flash_chart_object.php'; open_flash_chart_object( 500, 300, 'http://'. $_SERVER['SERVER_NAME'] .'/open-flash-chart/gallery-data-42.php' ); ?>
gallery-data-42.php
<?php include_once( 'ofc-library/open-flash-chart.php' );
$a = array(); $b = array(); $labels = array();
$a[] = new candle(10,8,6,4); $b[] = new candle(10,8,6,4); $labels[] = 'Mon'; $a[] = new candle(20,15,10,5); $b[] = new candle(20,10,15,5); $labels[] = 'Tue'; $a[] = new candle(20,15,10,5); $b[] = new candle(28,24,18,16); $labels[] = 'Wed'; $a[] = new candle(20,10,15,5); $b[] = new candle(10,6,9,4); $labels[] = 'Thu'; $a[] = new candle(30,5,27,2); $b[] = new candle(5,4,2,1); $labels[] = 'Fri';
// // ---- // $g = new graph(); $g->title( 'candle', '{font-size: 26px;}' );
//$g->set_data( $data );
// // LOOK: // $g->candle( $a, 60, 2, '#C11B01', 'My Company', 12 ); $g->candle( $b, 60, 2, '#B0C101', 'Your Company', 12 ); // // $g->set_tool_tip( '#x_legend#<br>High: #high#<br>Open: #open#<br>Close: #close#<br>Low: #low#' ); // //
$g->set_x_labels( $labels ); $g->set_x_label_style( 10, '#000000', 0, 1 ); $g->set_x_legend( 'Week 1', 12, '#C11B01' );
$g->set_y_min( 0 ); $g->set_y_max( 30 );
$g->y_label_steps( 10 ); $g->set_y_legend( 'Value', 12, '#C11B01' ); echo $g->render(); ?>
|
|