highcharts-rails 0.1.1 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +2 -1
- data/lib/highcharts/version.rb +1 -1
- data/vendor/assets/javascripts/highcharts.js +11454 -11103
- data/vendor/assets/javascripts/highcharts/adapters/mootools.js +264 -243
- data/vendor/assets/javascripts/highcharts/adapters/prototype.js +331 -284
- data/vendor/assets/javascripts/highcharts/modules/exporting.js +758 -703
- data/vendor/assets/javascripts/highcharts/themes/dark-blue.js +262 -267
- data/vendor/assets/javascripts/highcharts/themes/dark-green.js +262 -267
- data/vendor/assets/javascripts/highcharts/themes/gray.js +262 -262
- data/vendor/assets/javascripts/highcharts/themes/grid.js +96 -97
- metadata +8 -8
@@ -1,243 +1,264 @@
|
|
1
|
-
/**
|
2
|
-
* @license Highcharts JS v2.1.
|
3
|
-
* MooTools adapter
|
4
|
-
*
|
5
|
-
* (c) 2010-2011 Torstein Hønsi
|
6
|
-
*
|
7
|
-
* License: www.highcharts.com/license
|
8
|
-
*/
|
9
|
-
|
10
|
-
// JSLint options:
|
11
|
-
/*global
|
12
|
-
|
13
|
-
(function() {
|
14
|
-
|
15
|
-
var win = window,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
if (
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
}
|
242
|
-
|
243
|
-
|
1
|
+
/**
|
2
|
+
* @license Highcharts JS v2.1.9 (2011-11-11)
|
3
|
+
* MooTools adapter
|
4
|
+
*
|
5
|
+
* (c) 2010-2011 Torstein Hønsi
|
6
|
+
*
|
7
|
+
* License: www.highcharts.com/license
|
8
|
+
*/
|
9
|
+
|
10
|
+
// JSLint options:
|
11
|
+
/*global Fx, $, $extend, $each, $merge, Events, Event, DOMEvent */
|
12
|
+
|
13
|
+
(function () {
|
14
|
+
|
15
|
+
var win = window,
|
16
|
+
mooVersion = win.MooTools.version.substring(0, 3), // Get the first three characters of the version number
|
17
|
+
legacy = mooVersion === '1.2' || mooVersion === '1.1', // 1.1 && 1.2 considered legacy, 1.3 is not.
|
18
|
+
legacyEvent = legacy || mooVersion === '1.3', // In versions 1.1 - 1.3 the event class is named Event, in newer versions it is named DOMEvent.
|
19
|
+
$extend = win.$extend || function () {
|
20
|
+
return Object.append.apply(Object, arguments);
|
21
|
+
};
|
22
|
+
|
23
|
+
win.HighchartsAdapter = {
|
24
|
+
/**
|
25
|
+
* Initialize the adapter. This is run once as Highcharts is first run.
|
26
|
+
* @param {Object} pathAnim The helper object to do animations across adapters.
|
27
|
+
*/
|
28
|
+
init: function (pathAnim) {
|
29
|
+
var fxProto = Fx.prototype,
|
30
|
+
fxStart = fxProto.start,
|
31
|
+
morphProto = Fx.Morph.prototype,
|
32
|
+
morphCompute = morphProto.compute;
|
33
|
+
|
34
|
+
// override Fx.start to allow animation of SVG element wrappers
|
35
|
+
/*jslint unparam: true*//* allow unused parameters in fx functions */
|
36
|
+
fxProto.start = function (from, to) {
|
37
|
+
var fx = this,
|
38
|
+
elem = fx.element;
|
39
|
+
|
40
|
+
// special for animating paths
|
41
|
+
if (from.d) {
|
42
|
+
//this.fromD = this.element.d.split(' ');
|
43
|
+
fx.paths = pathAnim.init(
|
44
|
+
elem,
|
45
|
+
elem.d,
|
46
|
+
fx.toD
|
47
|
+
);
|
48
|
+
}
|
49
|
+
fxStart.apply(fx, arguments);
|
50
|
+
|
51
|
+
return this; // chainable
|
52
|
+
};
|
53
|
+
|
54
|
+
// override Fx.step to allow animation of SVG element wrappers
|
55
|
+
morphProto.compute = function (from, to, delta) {
|
56
|
+
var fx = this,
|
57
|
+
paths = fx.paths;
|
58
|
+
|
59
|
+
if (paths) {
|
60
|
+
fx.element.attr(
|
61
|
+
'd',
|
62
|
+
pathAnim.step(paths[0], paths[1], delta, fx.toD)
|
63
|
+
);
|
64
|
+
} else {
|
65
|
+
return morphCompute.apply(fx, arguments);
|
66
|
+
}
|
67
|
+
};
|
68
|
+
/*jslint unparam: false*/
|
69
|
+
},
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Animate a HTML element or SVG element wrapper
|
73
|
+
* @param {Object} el
|
74
|
+
* @param {Object} params
|
75
|
+
* @param {Object} options jQuery-like animation options: duration, easing, callback
|
76
|
+
*/
|
77
|
+
animate: function (el, params, options) {
|
78
|
+
var isSVGElement = el.attr,
|
79
|
+
effect,
|
80
|
+
complete = options && options.complete;
|
81
|
+
|
82
|
+
if (isSVGElement && !el.setStyle) {
|
83
|
+
// add setStyle and getStyle methods for internal use in Moo
|
84
|
+
el.getStyle = el.attr;
|
85
|
+
el.setStyle = function () { // property value is given as array in Moo - break it down
|
86
|
+
var args = arguments;
|
87
|
+
el.attr.call(el, args[0], args[1][0]);
|
88
|
+
};
|
89
|
+
// dirty hack to trick Moo into handling el as an element wrapper
|
90
|
+
el.$family = el.uid = true;
|
91
|
+
}
|
92
|
+
|
93
|
+
// stop running animations
|
94
|
+
win.HighchartsAdapter.stop(el);
|
95
|
+
|
96
|
+
// define and run the effect
|
97
|
+
effect = new Fx.Morph(
|
98
|
+
isSVGElement ? el : $(el),
|
99
|
+
$extend({
|
100
|
+
transition: Fx.Transitions.Quad.easeInOut
|
101
|
+
}, options)
|
102
|
+
);
|
103
|
+
|
104
|
+
// special treatment for paths
|
105
|
+
if (params.d) {
|
106
|
+
effect.toD = params.d;
|
107
|
+
}
|
108
|
+
|
109
|
+
// jQuery-like events
|
110
|
+
if (complete) {
|
111
|
+
effect.addEvent('complete', complete);
|
112
|
+
}
|
113
|
+
|
114
|
+
// run
|
115
|
+
effect.start(params);
|
116
|
+
|
117
|
+
// record for use in stop method
|
118
|
+
el.fx = effect;
|
119
|
+
},
|
120
|
+
|
121
|
+
/**
|
122
|
+
* MooTool's each function
|
123
|
+
*
|
124
|
+
*/
|
125
|
+
each: function (arr, fn) {
|
126
|
+
return legacy ?
|
127
|
+
$each(arr, fn) :
|
128
|
+
arr.each(fn);
|
129
|
+
},
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Map an array
|
133
|
+
* @param {Array} arr
|
134
|
+
* @param {Function} fn
|
135
|
+
*/
|
136
|
+
map: function (arr, fn) {
|
137
|
+
return arr.map(fn);
|
138
|
+
},
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Grep or filter an array
|
142
|
+
* @param {Array} arr
|
143
|
+
* @param {Function} fn
|
144
|
+
*/
|
145
|
+
grep: function (arr, fn) {
|
146
|
+
return arr.filter(fn);
|
147
|
+
},
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Deep merge two objects and return a third
|
151
|
+
*/
|
152
|
+
merge: function () {
|
153
|
+
var args = arguments,
|
154
|
+
args13 = [{}], // MooTools 1.3+
|
155
|
+
i = args.length,
|
156
|
+
ret;
|
157
|
+
|
158
|
+
if (legacy) {
|
159
|
+
ret = $merge.apply(null, args);
|
160
|
+
} else {
|
161
|
+
while (i--) {
|
162
|
+
// Boolean argumens should not be merged.
|
163
|
+
// JQuery explicitly skips this, so we do it here as well.
|
164
|
+
if (typeof args[i] !== 'boolean') {
|
165
|
+
args13[i + 1] = args[i];
|
166
|
+
}
|
167
|
+
}
|
168
|
+
ret = Object.merge.apply(Object, args13);
|
169
|
+
}
|
170
|
+
|
171
|
+
return ret;
|
172
|
+
},
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Extends an object with Events, if its not done
|
176
|
+
*/
|
177
|
+
extendWithEvents: function (el) {
|
178
|
+
// if the addEvent method is not defined, el is a custom Highcharts object
|
179
|
+
// like series or point
|
180
|
+
if (!el.addEvent) {
|
181
|
+
if (el.nodeName) {
|
182
|
+
el = $(el); // a dynamically generated node
|
183
|
+
} else {
|
184
|
+
$extend(el, new Events()); // a custom object
|
185
|
+
}
|
186
|
+
}
|
187
|
+
},
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Add an event listener
|
191
|
+
* @param {Object} el HTML element or custom object
|
192
|
+
* @param {String} type Event type
|
193
|
+
* @param {Function} fn Event handler
|
194
|
+
*/
|
195
|
+
addEvent: function (el, type, fn) {
|
196
|
+
if (typeof type === 'string') { // chart broke due to el being string, type function
|
197
|
+
|
198
|
+
if (type === 'unload') { // Moo self destructs before custom unload events
|
199
|
+
type = 'beforeunload';
|
200
|
+
}
|
201
|
+
|
202
|
+
win.HighchartsAdapter.extendWithEvents(el);
|
203
|
+
|
204
|
+
el.addEvent(type, fn);
|
205
|
+
}
|
206
|
+
},
|
207
|
+
|
208
|
+
removeEvent: function (el, type, fn) {
|
209
|
+
if (typeof el === 'string') {
|
210
|
+
// el.removeEvents below apperantly calls this method again. Do not quite understand why, so for now just bail out.
|
211
|
+
return;
|
212
|
+
}
|
213
|
+
win.HighchartsAdapter.extendWithEvents(el);
|
214
|
+
if (type) {
|
215
|
+
if (type === 'unload') { // Moo self destructs before custom unload events
|
216
|
+
type = 'beforeunload';
|
217
|
+
}
|
218
|
+
|
219
|
+
if (fn) {
|
220
|
+
el.removeEvent(type, fn);
|
221
|
+
} else {
|
222
|
+
el.removeEvents(type);
|
223
|
+
}
|
224
|
+
} else {
|
225
|
+
el.removeEvents();
|
226
|
+
}
|
227
|
+
},
|
228
|
+
|
229
|
+
fireEvent: function (el, event, eventArguments, defaultFunction) {
|
230
|
+
var eventArgs = {
|
231
|
+
type: event,
|
232
|
+
target: el
|
233
|
+
};
|
234
|
+
// create an event object that keeps all functions
|
235
|
+
event = legacyEvent ? new Event(eventArgs) : new DOMEvent(eventArgs);
|
236
|
+
event = $extend(event, eventArguments);
|
237
|
+
// override the preventDefault function to be able to use
|
238
|
+
// this for custom events
|
239
|
+
event.preventDefault = function () {
|
240
|
+
defaultFunction = null;
|
241
|
+
};
|
242
|
+
// if fireEvent is not available on the object, there hasn't been added
|
243
|
+
// any events to it above
|
244
|
+
if (el.fireEvent) {
|
245
|
+
el.fireEvent(event.type, event);
|
246
|
+
}
|
247
|
+
|
248
|
+
// fire the default if it is passed and it is not prevented above
|
249
|
+
if (defaultFunction) {
|
250
|
+
defaultFunction(event);
|
251
|
+
}
|
252
|
+
},
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Stop running animations on the object
|
256
|
+
*/
|
257
|
+
stop: function (el) {
|
258
|
+
if (el.fx) {
|
259
|
+
el.fx.cancel();
|
260
|
+
}
|
261
|
+
}
|
262
|
+
};
|
263
|
+
|
264
|
+
}());
|