Examples
All these examples are from teethgrinder.co.uk. Visit the page, it hosts even some more examples and tutorials.
This is the code that was used to generate the $chart object which we passed to this view:
$title = new title( 'Pork Pie, Mmmmm' );
$d = array();
$d[] = 2; // <-- blue
$d[] = 3; // <-- grey
$d[] = 4; // <-- green
$tmp = new pie_value(6.5, "");
//// this slice would normally be light green
// but we are overriding the colour here:
//$tmp->set_colour( '#FF33C9' );
$tmp->set_label('BIG', '#FF653F', 24 );
$d[] = $tmp;
//// here the colour cycle wraps and this gets the
// first colour:
//$d[] = new pie_value(6.5, "6.5"); // <-- blue
$d[] = 3; // <-- grey
$d[] = 4; // <-- green
$d[] = 2; // <-- light green
$pie = new pie();
$pie->start_angle(35)
->add_animation( new pie_fade() )
->add_animation( new pie_bounce(4) )
// ->label_colour('#432BAF') // <-- uncomment to see all labels set to blue
->gradient_fill()
->tooltip( '#val# of #total#<br>#percent# of 100%' )
->colours(
array(
'#1F8FA1', // <-- blue
'#848484', // <-- grey
'#CACFBE', // <-- green
'#DEF799' // <-- light green
) );
$pie->set_values( $d );
$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $pie );
return $chart;
This view uses the following code to render the graph:
$this->widget(
'application.extensions.OpenFlashChart2Widget.OpenFlashChart2Widget',
array(
'chart' => $chart,
'width' => '100%'
));