3d-bar-chart.php 601 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. srand((double)microtime()*1000000);
  3. $data = array();
  4. // add random height bars:
  5. for( $i=0; $i<10; $i++ )
  6. $data[] = rand(2,9);
  7. require_once('OFC/OFC_Chart.php');
  8. $title = new OFC_Elements_Title( date("D M d Y") );
  9. $bar = new OFC_Charts_Bar_3d();
  10. $bar->set_values( $data );
  11. $bar->colour = '#D54C78';
  12. $x_axis = new OFC_Elements_Axis_X();
  13. $x_axis->set_3d( 5 );
  14. $x_axis->colour = '#909090';
  15. $x_axis->set_labels( array(1,2,3,4,5,6,7,8,9,10) );
  16. $chart = new OFC_Chart();
  17. $chart->set_title( $title );
  18. $chart->add_element( $bar );
  19. $chart->set_x_axis( $x_axis );
  20. echo $chart->toPrettyString();