Charts - Candle Chart Menu - Candle Chart Negative Colours

Warning: There is a bug when using the on-show animation. It screws up the tooltips.

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", "300", "9.0.0", "expressInstall.swf",
{"data-file":"gallery/candle-chart-neg.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/candle-chart-neg.php
<?php

include '../php-ofc-library/open-flash-chart.php';

$title = new titledate("D M d Y") );

$data = array();

for(
$i=0$i<31$i++ )
{
    
$high = (sin($i/2)*4) + 16;
    
$open $high - (sin($i/2)*2);
    
$close $high -(cos($i/2)*2);
    
$low $high 8;
    
    if( 
abs($open-$close) < 0.3 )
    {
        
// force a Doji
        // (http://en.wikipedia.org/wiki/Candlestick_chart)
        
$open $close;
    }
    
    
$data[] = new candle_value(
        
number_format($high2),
        
number_format($open2),
        
number_format($close2),
        
number_format($low2));
    
}

$candle = new candle('#30E030''#E02020');
$candle->set_values($data);
$candle->set_tooltip('#x_label#<br>High: #high#<br>Open: #open#<br>Close: #close#<br>Low: #low#');
//$candle->set_on_show(new bar_on_show('drop', .9, 0));

$y = new y_axis();
$y->set_range04010);

$chart = new open_flash_chart();
$chart->set_title$title );
$chart->add_element$candle );
$chart->set_y_axis$y );

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


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