minor bug fix
[openemr.git] / library / openflashchart / js-ofc-library / open_flash_chart.js
blobad599e3dbb9c785c41c2a1a47d8d2d829490fd85
1 function ofc_chart() {
2         this.elements = [];
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         };
11         this.set_x_axis = function(axis) {
12                 this.x_axis = axis;
13         };
15         this.set_y_axis = function(axis) {
16                 this.y_axis = axis;
17         };
20 function ofc_element(type) {
21         this.type = type;
22         this.values = [];
24         this.set_values = function(values) {
25                 this.values = values;
26         };
28         this.set_key = function(text, size) {
29                 this.text = text;
30                 this['font-size'] = size;
31         };
33         this.set_colour = function(colour) {
34                 this.colour = colour;
35         };
38 function ofc_line() {
39         ofc_element.apply(this, ['line']);
41 ofc_line.prototype = new ofc_element();
43 function ofc_bar() {
44         ofc_element.apply(this, ['bar']);
46 ofc_bar.prototype = new ofc_element();
48 function ofc_scatter(colour) {
49         ofc_element.apply(this, ['scatter']);
50         this.set_colour(colour);
52         this.set_default_dot_style = function(dot_style) {
53                 this['dot-style'] = dot_style;
54         };
56 ofc_scatter.prototype = new ofc_element();
58 function ofc_scatter_line(colour) {
59         ofc_element.apply(this, ['scatter_line']);
60         this.set_colour(colour);
62         this.set_default_dot_style = function(dot_style) {
63                 this['dot-style'] = dot_style;
64         };
66         this.set_step_horizontal = function() {
67                 this.stepgraph = 'horizontal';
68         };
70         this.set_step_vertical = function() {
71                 this.stepgraph = 'vertical';
72         };
74 ofc_scatter_line.prototype = new ofc_element();
76 function ofc_title(text, style) {
77         this.text = text;
78         this.style = style;
81 function ofc_axis() {
82         this.set_range = function(min, max) {
83                 this.min = min;
84                 this.max = max;
85         };
87         this.set_steps = function(steps) {
88                 this.steps = steps;
89         };
91         this.set_stroke = function(stroke) {
92                 this.stroke = stroke;
93         };
95         this.set_colour = function(colour) {
96                 this.colour = colour;
97         };
99         this.set_grid_colour = function(grid_colour) {
100                 this['grid-colour'] = grid_colour;
101         };
103         this.set_offset = function(offset) {
104                 this.offset = offset;
105         };
108 function ofc_x_axis() {
109         this.set_tick_height = function(tick_height) {
110                 this['tick-height'] = tick_height;
111         };
113         this.set_3d = function(threeD) {
114                 this['3d'] = threeD;
115         };
117 ofc_x_axis.prototype = new ofc_axis();
119 function ofc_y_axis() {
120         this.set_tick_length = function(tick_length) {
121                 this['tick-length'] = tick_length;
122         };
124         this.set_grid_visible = function(grid_visible) {
125                 this['grid-visible'] = grid_visible;
126         };
128         this.set_visible = function(visible) {
129                 this.visible = visible;
130         };
132 ofc_y_axis.prototype = new ofc_axis();
134 function ofc_scatter_value(xVal, yVal, dot_size) {
135         this.x = xVal || 0;
136         this.y = yVal || 0;
137         this['dot-size'] = dot_size;
140 function ofc_dot_base(type, value) {
141         this.type = type;
142         this.value = value;
144         this.position = function position(xVal, yVal) {
145                 this.x = xVal;
146                 this.y = yVal;
147         };
150 function ofc_dot(value) {
151         ofc_dot_base.apply(this, ['dot', value]);
153 ofc_dot.prototype = new ofc_dot();
155 function ofc_hollow_dot(value) {
156         ofc_dot_base.apply(this, ['hollow-dot', value]);
158 ofc_hollow_dot.prototype = new ofc_dot_base();
160 function ofc_solid_dot(value) {
161         ofc_dot_base.apply(this, ['solid-dot', value]);
163 ofc_solid_dot.prototype = new ofc_dot();
165 function ofc_star(value) {
166         ofc_dot_base.apply(this, ['star', value]);
168 ofc_star.prototype = new ofc_dot_base();
170 function ofc_bow(value) {
171         ofc_dot_base.apply(this, ['bow', value]);
173 ofc_bow.prototype = new ofc_dot_base();
175 function ofc_anchor(value) {
176         ofc_dot_base.apply(this, ['anchor', value]);
178 ofc_anchor.prototype = new ofc_dot_base();
180 function ofc_pie() {
181         ofc_element.apply(this, ['pie']);
183         this.add_animation = function(animation) {
184                 if (!this.animate) {
185                         this.animate = [];
186                 }
187                 this.animate.push(animation);
188         };
190         this.set_alpha = function(alpha) {
191                 this.alpha = alpha;
192         };
194         this.set_colours = function(colours) {
195                 this.colours = colours;
196         };
198         this.set_start_angle = function(start_angle) {
199                 this['start-angle'] = start_angle;
200         };
202         this.set_tooltip = function(tip) {
203                 this.tip = tip;
204         };
206         this.set_gradient_fill = function() {
207                 this['gradient-fill'] = true;
208         };
210         this.set_label_colour = function (label_colour) {
211                 this['label-colour'] = label_colour;
212         };
214         this.set_no_labels = function() {
215                 this['no-labels'] = true;
216         };
218         this.on_click = function(event) {
219                 this['on-click'] = event;
220         };
222         this.radius = function(radius) {
223                 this.radius = radius;
224         };
226 ofc_pie.prototype = new ofc_element();
228 function ofc_pie_value(value, label) {
229         this.value = value;
230         this.label = label;
232         this.set_colour = function(colour) {
233                 this.colour = colour;
234         };
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         };
242         this.set_tooltip = function(tip) {
243                 this.tip = tip;
244         };
246         this.on_click = function(event) {
247                 this['on-click'] = event;
248         };
250         this.add_animation = function(animation) {
251                 if (!this.animate) {
252                         this.animate = [];
253                 }
254                 this.animate.push(animation);
255         };
258 function ofc_base_pie_animation(type) {
259         this.type = type;
262 function ofc_pie_fade() {
263         ofc_base_pie_animation.apply(this, ['fade']);
265 ofc_pie_fade.prototype = new ofc_base_pie_animation();
267 function ofc_pie_bounce(distance) {
268         ofc_base_pie_animation.apply(this, ['bounce']);
269         this.distance = distance;
271 ofc_pie_bounce.prototype = new ofc_base_pie_animation();