| 1 | function 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 |
|
|---|
| 20 | function 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 |
|
|---|
| 38 | function ofc_line() {
|
|---|
| 39 | ofc_element.apply(this, ['line']);
|
|---|
| 40 | }
|
|---|
| 41 | ofc_line.prototype = new ofc_element();
|
|---|
| 42 |
|
|---|
| 43 | function ofc_bar() {
|
|---|
| 44 | ofc_element.apply(this, ['bar']);
|
|---|
| 45 | }
|
|---|
| 46 | ofc_bar.prototype = new ofc_element();
|
|---|
| 47 |
|
|---|
| 48 | function 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 | }
|
|---|
| 56 | ofc_scatter.prototype = new ofc_element();
|
|---|
| 57 |
|
|---|
| 58 | function 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 | }
|
|---|
| 74 | ofc_scatter_line.prototype = new ofc_element();
|
|---|
| 75 |
|
|---|
| 76 | function ofc_title(text, style) {
|
|---|
| 77 | this.text = text;
|
|---|
| 78 | this.style = style;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | function 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 |
|
|---|
| 108 | function 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 | }
|
|---|
| 117 | ofc_x_axis.prototype = new ofc_axis();
|
|---|
| 118 |
|
|---|
| 119 | function 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 | }
|
|---|
| 132 | ofc_y_axis.prototype = new ofc_axis();
|
|---|
| 133 |
|
|---|
| 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;
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | function 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 |
|
|---|
| 150 | function ofc_dot(value) {
|
|---|
| 151 | ofc_dot_base.apply(this, ['dot', value]);
|
|---|
| 152 | }
|
|---|
| 153 | ofc_dot.prototype = new ofc_dot();
|
|---|
| 154 |
|
|---|
| 155 | function ofc_hollow_dot(value) {
|
|---|
| 156 | ofc_dot_base.apply(this, ['hollow-dot', value]);
|
|---|
| 157 | }
|
|---|
| 158 | ofc_hollow_dot.prototype = new ofc_dot_base();
|
|---|
| 159 |
|
|---|
| 160 | function ofc_solid_dot(value) {
|
|---|
| 161 | ofc_dot_base.apply(this, ['solid-dot', value]);
|
|---|
| 162 | }
|
|---|
| 163 | ofc_solid_dot.prototype = new ofc_dot();
|
|---|
| 164 |
|
|---|
| 165 | function ofc_star(value) {
|
|---|
| 166 | ofc_dot_base.apply(this, ['star', value]);
|
|---|
| 167 | }
|
|---|
| 168 | ofc_star.prototype = new ofc_dot_base();
|
|---|
| 169 |
|
|---|
| 170 | function ofc_bow(value) {
|
|---|
| 171 | ofc_dot_base.apply(this, ['bow', value]);
|
|---|
| 172 | }
|
|---|
| 173 | ofc_bow.prototype = new ofc_dot_base();
|
|---|
| 174 |
|
|---|
| 175 | function ofc_anchor(value) {
|
|---|
| 176 | ofc_dot_base.apply(this, ['anchor', value]);
|
|---|
| 177 | }
|
|---|
| 178 | ofc_anchor.prototype = new ofc_dot_base();
|
|---|
| 179 |
|
|---|
| 180 | function 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 | }
|
|---|
| 226 | ofc_pie.prototype = new ofc_element();
|
|---|
| 227 |
|
|---|
| 228 | function 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 |
|
|---|
| 258 | function ofc_base_pie_animation(type) {
|
|---|
| 259 | this.type = type;
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | function ofc_pie_fade() {
|
|---|
| 263 | ofc_base_pie_animation.apply(this, ['fade']);
|
|---|
| 264 | }
|
|---|
| 265 | ofc_pie_fade.prototype = new ofc_base_pie_animation();
|
|---|
| 266 |
|
|---|
| 267 | function ofc_pie_bounce(distance) {
|
|---|
| 268 | ofc_base_pie_animation.apply(this, ['bounce']);
|
|---|
| 269 | this.distance = distance;
|
|---|
| 270 | }
|
|---|
| 271 | ofc_pie_bounce.prototype = new ofc_base_pie_animation();
|
|---|