open-flash-chart.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. // var_dump(debug_backtrace());
  3. //
  4. // Omar Kilani's php C extension for encoding JSON has been incorporated in stock PHP since 5.2.0
  5. // http://www.aurore.net/projects/php-json/
  6. //
  7. // -- Marcus Engene
  8. //
  9. if (! function_exists('json_encode'))
  10. {
  11. include_once 'JSON.php';
  12. }
  13. include_once 'json_format.php';
  14. // ofc classes
  15. include_once 'ofc_title.php';
  16. include_once 'ofc_y_axis_base.php';
  17. include_once 'ofc_y_axis.php';
  18. include_once 'ofc_y_axis_right.php';
  19. include_once 'ofc_x_axis.php';
  20. include_once 'ofc_area_base.php';
  21. include_once 'ofc_area_hollow.php';
  22. include_once 'ofc_area_line.php';
  23. include_once 'ofc_pie.php';
  24. include_once 'ofc_bar.php';
  25. include_once 'ofc_bar_filled.php';
  26. include_once 'ofc_bar_glass.php';
  27. include_once 'ofc_bar_stack.php';
  28. include_once 'ofc_bar_3d.php';
  29. include_once 'ofc_hbar.php';
  30. include_once 'ofc_line_base.php';
  31. include_once 'ofc_line.php';
  32. include_once 'ofc_line_dot.php';
  33. include_once 'ofc_line_hollow.php';
  34. include_once 'ofc_x_legend.php';
  35. include_once 'ofc_y_legend.php';
  36. include_once 'ofc_bar_sketch.php';
  37. include_once 'ofc_scatter.php';
  38. include_once 'ofc_scatter_line.php';
  39. include_once 'ofc_x_axis_labels.php';
  40. include_once 'ofc_x_axis_label.php';
  41. include_once 'ofc_tooltip.php';
  42. include_once 'ofc_shape.php';
  43. include_once 'ofc_radar_axis.php';
  44. include_once 'ofc_radar_axis_labels.php';
  45. include_once 'ofc_radar_spoke_labels.php';
  46. include_once 'ofc_line_style.php';
  47. class open_flash_chart
  48. {
  49. function open_flash_chart()
  50. {
  51. //$this->title = new title( "Many data lines" );
  52. $this->elements = array();
  53. }
  54. function set_title( $t )
  55. {
  56. $this->title = $t;
  57. }
  58. function set_x_axis( $x )
  59. {
  60. $this->x_axis = $x;
  61. }
  62. function set_y_axis( $y )
  63. {
  64. $this->y_axis = $y;
  65. }
  66. function add_y_axis( $y )
  67. {
  68. $this->y_axis = $y;
  69. }
  70. function set_y_axis_right( $y )
  71. {
  72. $this->y_axis_right = $y;
  73. }
  74. function add_element( $e )
  75. {
  76. $this->elements[] = $e;
  77. }
  78. function set_x_legend( $x )
  79. {
  80. $this->x_legend = $x;
  81. }
  82. function set_y_legend( $y )
  83. {
  84. $this->y_legend = $y;
  85. }
  86. function set_bg_colour( $colour )
  87. {
  88. $this->bg_colour = $colour;
  89. }
  90. function set_radar_axis( $radar )
  91. {
  92. $this->radar_axis = $radar;
  93. }
  94. function set_tooltip( $tooltip )
  95. {
  96. $this->tooltip = $tooltip;
  97. }
  98. function toString()
  99. {
  100. if (function_exists('json_encode'))
  101. {
  102. return json_encode($this);
  103. }
  104. else
  105. {
  106. $json = new Services_JSON();
  107. return $json->encode( $this );
  108. }
  109. }
  110. function toPrettyString()
  111. {
  112. return json_format( $this->toString() );
  113. }
  114. }
  115. //
  116. // there is no PHP end tag so we don't mess the headers up!
  117. //