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:

  1.  <?php
  2.   
  3.  $title = new title( 'Pork Pie, Mmmmm' );
  4.   
  5.  $pie = new pie();
  6.  $pie->set_alpha(0.6);
  7.  $pie->set_start_angle( 35 );
  8.  $pie->add_animation( new pie_fade() );
  9.  $pie->set_tooltip( '#val# of #total#<br>#percent# of 100%' );
  10.  $pie->set_colours( array('#1C9E05','#FF368D') );
  11.  $pie->set_values( array(2,3,4,new pie_value(6.5, "hello (6.5)")) );
  12.   
  13.  $chart = new open_flash_chart();
  14.  $chart->set_title( $title );
  15.  $chart->add_element( $pie );
  16.   
  17.   
  18.  $chart->x_axis = null;
  19.   
  20.  return $chart;

This view uses the following code to render the graph:

  1.   
  2.  $this->widget(
  3.    'application.extensions.OpenFlashChart2Widget.OpenFlashChart2Widget',
  4.    array(
  5.      'chart' => $chart,
  6.      'width' => '100%'
  7.    )
  8.  );