1 | <?php
|
---|
2 |
|
---|
3 | // var_dump(debug_backtrace());
|
---|
4 |
|
---|
5 | //
|
---|
6 | // Omar Kilani's php C extension for encoding JSON has been incorporated in stock PHP since 5.2.0
|
---|
7 | // http://www.aurore.net/projects/php-json/
|
---|
8 | //
|
---|
9 | // -- Marcus Engene
|
---|
10 | //
|
---|
11 | if (! function_exists('json_encode'))
|
---|
12 | {
|
---|
13 | include_once 'JSON.php';
|
---|
14 | }
|
---|
15 |
|
---|
16 | include_once 'json_format.php';
|
---|
17 |
|
---|
18 | // ofc classes
|
---|
19 | include_once 'ofc_title.php';
|
---|
20 | include_once 'ofc_y_axis_base.php';
|
---|
21 | include_once 'ofc_y_axis.php';
|
---|
22 | include_once 'ofc_y_axis_right.php';
|
---|
23 | include_once 'ofc_y_axis_labels.php';
|
---|
24 | include_once 'ofc_y_axis_label.php';
|
---|
25 | include_once 'ofc_x_axis.php';
|
---|
26 |
|
---|
27 |
|
---|
28 | include_once 'ofc_pie.php';
|
---|
29 | //include_once 'ofc_bar.php';
|
---|
30 | include_once 'ofc_bar_glass.php';
|
---|
31 | include_once 'ofc_bar_filled.php';
|
---|
32 | include_once 'ofc_bar_stack.php';
|
---|
33 | //include_once 'ofc_bar_3d.php';
|
---|
34 | include_once 'ofc_hbar.php';
|
---|
35 | include_once 'ofc_line_base.php';
|
---|
36 | include_once 'ofc_line.php';
|
---|
37 | //include_once 'ofc_line_dot.php';
|
---|
38 | //include_once 'ofc_line_hollow.php';
|
---|
39 | include_once 'ofc_candle.php';
|
---|
40 | include_once 'ofc_area_base.php';
|
---|
41 | include_once 'ofc_tags.php';
|
---|
42 | include_once 'ofc_arrow.php';
|
---|
43 | //include_once 'ofc_area_hollow.php';
|
---|
44 | //include_once 'ofc_area_line.php';
|
---|
45 |
|
---|
46 | include_once 'ofc_x_legend.php';
|
---|
47 | include_once 'ofc_y_legend.php';
|
---|
48 | include_once 'ofc_bar_sketch.php';
|
---|
49 | include_once 'ofc_scatter.php';
|
---|
50 | include_once 'ofc_scatter_line.php';
|
---|
51 | include_once 'ofc_x_axis_labels.php';
|
---|
52 | include_once 'ofc_x_axis_label.php';
|
---|
53 | include_once 'ofc_tooltip.php';
|
---|
54 | include_once 'ofc_shape.php';
|
---|
55 | include_once 'ofc_radar_axis.php';
|
---|
56 | include_once 'ofc_radar_axis_labels.php';
|
---|
57 | include_once 'ofc_radar_spoke_labels.php';
|
---|
58 | include_once 'ofc_line_style.php';
|
---|
59 |
|
---|
60 | include_once 'dot_base.php';
|
---|
61 | include_once 'ofc_menu.php';
|
---|
62 |
|
---|
63 | class open_flash_chart
|
---|
64 | {
|
---|
65 | function open_flash_chart()
|
---|
66 | {
|
---|
67 | //$this->title = new title( "Many data lines" );
|
---|
68 | $this->elements = array();
|
---|
69 | }
|
---|
70 |
|
---|
71 | function set_title( $t )
|
---|
72 | {
|
---|
73 | $this->title = $t;
|
---|
74 | }
|
---|
75 |
|
---|
76 | function set_x_axis( $x )
|
---|
77 | {
|
---|
78 | $this->x_axis = $x;
|
---|
79 | }
|
---|
80 |
|
---|
81 | function set_y_axis( $y )
|
---|
82 | {
|
---|
83 | $this->y_axis = $y;
|
---|
84 | }
|
---|
85 |
|
---|
86 | function add_y_axis( $y )
|
---|
87 | {
|
---|
88 | $this->y_axis = $y;
|
---|
89 | }
|
---|
90 |
|
---|
91 | function set_y_axis_right( $y )
|
---|
92 | {
|
---|
93 | $this->y_axis_right = $y;
|
---|
94 | }
|
---|
95 |
|
---|
96 | function add_element( $e )
|
---|
97 | {
|
---|
98 | $this->elements[] = $e;
|
---|
99 | }
|
---|
100 |
|
---|
101 | function set_x_legend( $x )
|
---|
102 | {
|
---|
103 | $this->x_legend = $x;
|
---|
104 | }
|
---|
105 |
|
---|
106 | function set_y_legend( $y )
|
---|
107 | {
|
---|
108 | $this->y_legend = $y;
|
---|
109 | }
|
---|
110 |
|
---|
111 | function set_bg_colour( $colour )
|
---|
112 | {
|
---|
113 | $this->bg_colour = $colour;
|
---|
114 | }
|
---|
115 |
|
---|
116 | function set_radar_axis( $radar )
|
---|
117 | {
|
---|
118 | $this->radar_axis = $radar;
|
---|
119 | }
|
---|
120 |
|
---|
121 | function set_tooltip( $tooltip )
|
---|
122 | {
|
---|
123 | $this->tooltip = $tooltip;
|
---|
124 | }
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * This is a bit funky :(
|
---|
128 | *
|
---|
129 | * @param $num_decimals as integer. Truncate the decimals to $num_decimals, e.g. set it
|
---|
130 | * to 5 and 3.333333333 will display as 3.33333. 2.0 will display as 2 (or 2.00000 - see below)
|
---|
131 | * @param $is_fixed_num_decimals_forced as boolean. If true it will pad the decimals.
|
---|
132 | * @param $is_decimal_separator_comma as boolean
|
---|
133 | * @param $is_thousand_separator_disabled as boolean
|
---|
134 | *
|
---|
135 | * This needs a bit of love and attention
|
---|
136 | */
|
---|
137 | function set_number_format($num_decimals, $is_fixed_num_decimals_forced, $is_decimal_separator_comma, $is_thousand_separator_disabled )
|
---|
138 | {
|
---|
139 | $this->num_decimals = $num_decimals;
|
---|
140 | $this->is_fixed_num_decimals_forced = $is_fixed_num_decimals_forced;
|
---|
141 | $this->is_decimal_separator_comma = $is_decimal_separator_comma;
|
---|
142 | $this->is_thousand_separator_disabled = $is_thousand_separator_disabled;
|
---|
143 | }
|
---|
144 |
|
---|
145 | /**
|
---|
146 | * This is experimental and will change as we make it work
|
---|
147 | *
|
---|
148 | * @param $m as ofc_menu
|
---|
149 | */
|
---|
150 | function set_menu($m)
|
---|
151 | {
|
---|
152 | $this->menu = $m;
|
---|
153 | }
|
---|
154 |
|
---|
155 | function toString()
|
---|
156 | {
|
---|
157 | if (function_exists('json_encode'))
|
---|
158 | {
|
---|
159 | return json_encode($this);
|
---|
160 | }
|
---|
161 | else
|
---|
162 | {
|
---|
163 | $json = new Services_JSON();
|
---|
164 | return $json->encode( $this );
|
---|
165 | }
|
---|
166 | }
|
---|
167 |
|
---|
168 | function toPrettyString()
|
---|
169 | {
|
---|
170 | return json_format( $this->toString() );
|
---|
171 | }
|
---|
172 | }
|
---|
173 |
|
---|
174 |
|
---|
175 |
|
---|
176 | //
|
---|
177 | // there is no PHP end tag so we don't mess the headers up!
|
---|
178 | //
|
---|