source: code/Website/js-ofc-library/open_flash_chart.js

Last change on this file was 7849, checked in by dennisw, 16 years ago
File size: 5.2 KB
Line 
1function ofc_chart() {
2 this.elements = [];
3
4 this.set_title = function(title) {
5 this.title = title;
6 };
7 this.add_element = function(new_element) {
8 this.elements.push(new_element);
9 };
10
11 this.set_x_axis = function(axis) {
12 this.x_axis = axis;
13 };
14
15 this.set_y_axis = function(axis) {
16 this.y_axis = axis;
17 };
18}
19
20function ofc_element(type) {
21 this.type = type;
22 this.values = [];
23
24 this.set_values = function(values) {
25 this.values = values;
26 };
27
28 this.set_key = function(text, size) {
29 this.text = text;
30 this['font-size'] = size;
31 };
32
33 this.set_colour = function(colour) {
34 this.colour = colour;
35 };
36}
37
38function ofc_line() {
39 ofc_element.apply(this, ['line']);
40}
41ofc_line.prototype = new ofc_element();
42
43function ofc_bar() {
44 ofc_element.apply(this, ['bar']);
45}
46ofc_bar.prototype = new ofc_element();
47
48function ofc_scatter(colour) {
49 ofc_element.apply(this, ['scatter']);
50 this.set_colour(colour);
51
52 this.set_default_dot_style = function(dot_style) {
53 this['dot-style'] = dot_style;
54 };
55}
56ofc_scatter.prototype = new ofc_element();
57
58function ofc_scatter_line(colour) {
59 ofc_element.apply(this, ['scatter_line']);
60 this.set_colour(colour);
61
62 this.set_default_dot_style = function(dot_style) {
63 this['dot-style'] = dot_style;
64 };
65
66 this.set_step_horizontal = function() {
67 this.stepgraph = 'horizontal';
68 };
69
70 this.set_step_vertical = function() {
71 this.stepgraph = 'vertical';
72 };
73}
74ofc_scatter_line.prototype = new ofc_element();
75
76function ofc_title(text, style) {
77 this.text = text;
78 this.style = style;
79}
80
81function ofc_axis() {
82 this.set_range = function(min, max) {
83 this.min = min;
84 this.max = max;
85 };
86
87 this.set_steps = function(steps) {
88 this.steps = steps;
89 };
90
91 this.set_stroke = function(stroke) {
92 this.stroke = stroke;
93 };
94
95 this.set_colour = function(colour) {
96 this.colour = colour;
97 };
98
99 this.set_grid_colour = function(grid_colour) {
100 this['grid-colour'] = grid_colour;
101 };
102
103 this.set_offset = function(offset) {
104 this.offset = offset;
105 };
106}
107
108function ofc_x_axis() {
109 this.set_tick_height = function(tick_height) {
110 this['tick-height'] = tick_height;
111 };
112
113 this.set_3d = function(threeD) {
114 this['3d'] = threeD;
115 };
116}
117ofc_x_axis.prototype = new ofc_axis();
118
119function ofc_y_axis() {
120 this.set_tick_length = function(tick_length) {
121 this['tick-length'] = tick_length;
122 };
123
124 this.set_grid_visible = function(grid_visible) {
125 this['grid-visible'] = grid_visible;
126 };
127
128 this.set_visible = function(visible) {
129 this.visible = visible;
130 };
131}
132ofc_y_axis.prototype = new ofc_axis();
133
134function ofc_scatter_value(xVal, yVal, dot_size) {
135 this.x = xVal || 0;
136 this.y = yVal || 0;
137 this['dot-size'] = dot_size;
138}
139
140function ofc_dot_base(type, value) {
141 this.type = type;
142 this.value = value;
143
144 this.position = function position(xVal, yVal) {
145 this.x = xVal;
146 this.y = yVal;
147 };
148}
149
150function ofc_dot(value) {
151 ofc_dot_base.apply(this, ['dot', value]);
152}
153ofc_dot.prototype = new ofc_dot();
154
155function ofc_hollow_dot(value) {
156 ofc_dot_base.apply(this, ['hollow-dot', value]);
157}
158ofc_hollow_dot.prototype = new ofc_dot_base();
159
160function ofc_solid_dot(value) {
161 ofc_dot_base.apply(this, ['solid-dot', value]);
162}
163ofc_solid_dot.prototype = new ofc_dot();
164
165function ofc_star(value) {
166 ofc_dot_base.apply(this, ['star', value]);
167}
168ofc_star.prototype = new ofc_dot_base();
169
170function ofc_bow(value) {
171 ofc_dot_base.apply(this, ['bow', value]);
172}
173ofc_bow.prototype = new ofc_dot_base();
174
175function ofc_anchor(value) {
176 ofc_dot_base.apply(this, ['anchor', value]);
177}
178ofc_anchor.prototype = new ofc_dot_base();
179
180function ofc_pie() {
181 ofc_element.apply(this, ['pie']);
182
183 this.add_animation = function(animation) {
184 if (!this.animate) {
185 this.animate = [];
186 }
187 this.animate.push(animation);
188 };
189
190 this.set_alpha = function(alpha) {
191 this.alpha = alpha;
192 };
193
194 this.set_colours = function(colours) {
195 this.colours = colours;
196 };
197
198 this.set_start_angle = function(start_angle) {
199 this['start-angle'] = start_angle;
200 };
201
202 this.set_tooltip = function(tip) {
203 this.tip = tip;
204 };
205
206 this.set_gradient_fill = function() {
207 this['gradient-fill'] = true;
208 };
209
210 this.set_label_colour = function (label_colour) {
211 this['label-colour'] = label_colour;
212 };
213
214 this.set_no_labels = function() {
215 this['no-labels'] = true;
216 };
217
218 this.on_click = function(event) {
219 this['on-click'] = event;
220 };
221
222 this.radius = function(radius) {
223 this.radius = radius;
224 };
225}
226ofc_pie.prototype = new ofc_element();
227
228function ofc_pie_value(value, label) {
229 this.value = value;
230 this.label = label;
231
232 this.set_colour = function(colour) {
233 this.colour = colour;
234 };
235
236 this.set_label = function(label, label_colour, font_size) {
237 this.label = label;
238 this['label-colour'] = label_colour;
239 this['font-size'] = font_size;
240 };
241
242 this.set_tooltip = function(tip) {
243 this.tip = tip;
244 };
245
246 this.on_click = function(event) {
247 this['on-click'] = event;
248 };
249
250 this.add_animation = function(animation) {
251 if (!this.animate) {
252 this.animate = [];
253 }
254 this.animate.push(animation);
255 };
256}
257
258function ofc_base_pie_animation(type) {
259 this.type = type;
260}
261
262function ofc_pie_fade() {
263 ofc_base_pie_animation.apply(this, ['fade']);
264}
265ofc_pie_fade.prototype = new ofc_base_pie_animation();
266
267function ofc_pie_bounce(distance) {
268 ofc_base_pie_animation.apply(this, ['bounce']);
269 this.distance = distance;
270}
271ofc_pie_bounce.prototype = new ofc_base_pie_animation();
Note: See TracBrowser for help on using the repository browser.