ofc_pie.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. class pie_value
  3. {
  4. function pie_value( $value, $label )
  5. {
  6. $this->value = $value;
  7. $this->label = $label;
  8. }
  9. function set_colour( $colour )
  10. {
  11. $this->colour = $colour;
  12. }
  13. function set_label( $label, $label_colour, $font_size )
  14. {
  15. $this->label = $label;
  16. $tmp = 'label-colour';
  17. $this->$tmp = $label_colour;
  18. $tmp = 'font-size';
  19. $this->$tmp = $font_size;
  20. }
  21. function set_tooltip( $tip )
  22. {
  23. $this->tip = $tip;
  24. }
  25. function on_click( $event )
  26. {
  27. $tmp = 'on-click';
  28. $this->$tmp = $event;
  29. }
  30. }
  31. class pie
  32. {
  33. function pie()
  34. {
  35. $this->type = 'pie';
  36. $this->colours = array("#d01f3c","#356aa0","#C79810");
  37. $this->border = 2;
  38. }
  39. function set_colours( $colours )
  40. {
  41. $this->colours = $colours;
  42. }
  43. function set_alpha( $alpha )
  44. {
  45. $this->alpha = $alpha;
  46. }
  47. function set_values( $v )
  48. {
  49. $this->values = $v;
  50. }
  51. // boolean
  52. function set_animate( $animate )
  53. {
  54. $this->animate = $animate;
  55. }
  56. // real
  57. function set_start_angle( $angle )
  58. {
  59. $tmp = 'start-angle';
  60. $this->$tmp = $angle;
  61. }
  62. function set_tooltip( $tip )
  63. {
  64. $this->tip = $tip;
  65. }
  66. function set_gradient_fill()
  67. {
  68. $tmp = 'gradient-fill';
  69. $this->$tmp = true;
  70. }
  71. function set_label_colour( $label_colour )
  72. {
  73. $tmp = 'label-colour';
  74. $this->$tmp = $label_colour;
  75. }
  76. /**
  77. * Turn off the labels
  78. */
  79. function set_no_labels()
  80. {
  81. $tmp = 'no-labels';
  82. $this->$tmp = true;
  83. }
  84. function on_click( $event )
  85. {
  86. $tmp = 'on-click';
  87. $this->$tmp = $event;
  88. }
  89. }