rgraph-rails 1.0.3 → 1.0.4

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.
Files changed (63) hide show
  1. checksums.yaml +8 -8
  2. data/.travis.yml +1 -0
  3. data/README.md +5 -5
  4. data/lib/rgraph-rails/version.rb +1 -1
  5. data/rgraph-rails.gemspec +2 -2
  6. data/vendor/assets/images/bg.png +0 -0
  7. data/vendor/assets/images/bullet.png +0 -0
  8. data/vendor/assets/images/facebook-large.png +0 -0
  9. data/vendor/assets/images/google-plus-large.png +0 -0
  10. data/vendor/assets/images/logo.png +0 -0
  11. data/vendor/assets/images/meter-image-sd-needle.png +0 -0
  12. data/vendor/assets/images/meter-image-sd.png +0 -0
  13. data/vendor/assets/images/meter-sketch-needle.png +0 -0
  14. data/vendor/assets/images/meter-sketch.png +0 -0
  15. data/vendor/assets/images/odometer-background.png +0 -0
  16. data/vendor/assets/images/rgraph.jpg +0 -0
  17. data/vendor/assets/images/title.png +0 -0
  18. data/vendor/assets/images/twitter-large.png +0 -0
  19. data/vendor/assets/javascripts/RGraph.bar.js +258 -30
  20. data/vendor/assets/javascripts/RGraph.bipolar.js +4 -3
  21. data/vendor/assets/javascripts/RGraph.common.annotate.js +4 -3
  22. data/vendor/assets/javascripts/RGraph.common.context.js +4 -3
  23. data/vendor/assets/javascripts/RGraph.common.core.js +227 -105
  24. data/vendor/assets/javascripts/RGraph.common.csv.js +4 -3
  25. data/vendor/assets/javascripts/RGraph.common.deprecated.js +4 -3
  26. data/vendor/assets/javascripts/RGraph.common.dynamic.js +5 -4
  27. data/vendor/assets/javascripts/RGraph.common.effects.js +4 -3
  28. data/vendor/assets/javascripts/RGraph.common.key.js +4 -3
  29. data/vendor/assets/javascripts/RGraph.common.resizing.js +4 -3
  30. data/vendor/assets/javascripts/RGraph.common.sheets.js +357 -0
  31. data/vendor/assets/javascripts/RGraph.common.tooltips.js +6 -4
  32. data/vendor/assets/javascripts/RGraph.common.zoom.js +4 -3
  33. data/vendor/assets/javascripts/RGraph.drawing.background.js +4 -3
  34. data/vendor/assets/javascripts/RGraph.drawing.circle.js +4 -3
  35. data/vendor/assets/javascripts/RGraph.drawing.image.js +4 -3
  36. data/vendor/assets/javascripts/RGraph.drawing.marker1.js +4 -3
  37. data/vendor/assets/javascripts/RGraph.drawing.marker2.js +4 -3
  38. data/vendor/assets/javascripts/RGraph.drawing.marker3.js +1 -1
  39. data/vendor/assets/javascripts/RGraph.drawing.poly.js +1 -1
  40. data/vendor/assets/javascripts/RGraph.drawing.rect.js +1 -1
  41. data/vendor/assets/javascripts/RGraph.drawing.text.js +1 -1
  42. data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +1 -1
  43. data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +33 -30
  44. data/vendor/assets/javascripts/RGraph.fuel.js +14 -16
  45. data/vendor/assets/javascripts/RGraph.funnel.js +1 -1
  46. data/vendor/assets/javascripts/RGraph.gantt.js +1 -1
  47. data/vendor/assets/javascripts/RGraph.gauge.js +3 -5
  48. data/vendor/assets/javascripts/RGraph.hbar.js +738 -212
  49. data/vendor/assets/javascripts/RGraph.hprogress.js +30 -33
  50. data/vendor/assets/javascripts/RGraph.line.js +246 -31
  51. data/vendor/assets/javascripts/RGraph.meter.js +72 -36
  52. data/vendor/assets/javascripts/RGraph.modaldialog.js +1 -1
  53. data/vendor/assets/javascripts/RGraph.odo.js +3 -5
  54. data/vendor/assets/javascripts/RGraph.pie.js +23 -15
  55. data/vendor/assets/javascripts/RGraph.radar.js +1 -1
  56. data/vendor/assets/javascripts/RGraph.rose.js +2 -2
  57. data/vendor/assets/javascripts/RGraph.rscatter.js +116 -27
  58. data/vendor/assets/javascripts/RGraph.scatter.js +14 -15
  59. data/vendor/assets/javascripts/RGraph.thermometer.js +8 -10
  60. data/vendor/assets/javascripts/RGraph.vprogress.js +8 -10
  61. data/vendor/assets/javascripts/RGraph.waterfall.js +1 -1
  62. data/vendor/assets/stylesheets/website.css +32 -2
  63. metadata +6 -5
@@ -1,4 +1,4 @@
1
- // version: 2015-11-02
1
+ // version: 2016-02-06
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,8 +7,9 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just �99 (GBP) and you can |
11
- * | read about it here: |
10
+ * | the terms of the GPL. The commercial license starts at just �99 (GBP) and |
11
+ * | you can read about it here: |
12
+ * | |
12
13
  * | http://www.rgraph.net/license |
13
14
  * o--------------------------------------------------------------------------------o
14
15
  */
@@ -1,4 +1,4 @@
1
- // version: 2015-11-02
1
+ // version: 2016-02-06
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,8 +7,9 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just �99 (GBP) and you can |
11
- * | read about it here: |
10
+ * | the terms of the GPL. The commercial license starts at just �99 (GBP) and |
11
+ * | you can read about it here: |
12
+ * | |
12
13
  * | http://www.rgraph.net/license |
13
14
  * o--------------------------------------------------------------------------------o
14
15
  */
@@ -1,4 +1,4 @@
1
- // version: 2015-11-02
1
+ // version: 2016-02-06
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,8 +7,9 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just �99 (GBP) and you can |
11
- * | read about it here: |
10
+ * | the terms of the GPL. The commercial license starts at just �99 (GBP) and |
11
+ * | you can read about it here: |
12
+ * | |
12
13
  * | http://www.rgraph.net/license |
13
14
  * o--------------------------------------------------------------------------------o
14
15
  */
@@ -189,7 +190,7 @@
189
190
  // Tooltips
190
191
  // ========================================================================
191
192
 
192
-
193
+
193
194
  if (!RG.isNull(obj) && RG.tooltip) {
194
195
 
195
196
  var shape = obj.getShape(e);
@@ -1,4 +1,4 @@
1
- // version: 2015-11-02
1
+ // version: 2016-02-06
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,8 +7,9 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just �99 (GBP) and you can |
11
- * | read about it here: |
10
+ * | the terms of the GPL. The commercial license starts at just �99 (GBP) and |
11
+ * | you can read about it here: |
12
+ * | |
12
13
  * | http://www.rgraph.net/license |
13
14
  * o--------------------------------------------------------------------------------o
14
15
  */
@@ -1,4 +1,4 @@
1
- // version: 2015-11-02
1
+ // version: 2016-02-06
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,8 +7,9 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just �99 (GBP) and you can |
11
- * | read about it here: |
10
+ * | the terms of the GPL. The commercial license starts at just �99 (GBP) and |
11
+ * | you can read about it here: |
12
+ * | |
12
13
  * | http://www.rgraph.net/license |
13
14
  * o--------------------------------------------------------------------------------o
14
15
  */
@@ -1,4 +1,4 @@
1
- // version: 2015-11-02
1
+ // version: 2016-02-06
2
2
  /**
3
3
  * o--------------------------------------------------------------------------------o
4
4
  * | This file is part of the RGraph package - you can learn more at: |
@@ -7,8 +7,9 @@
7
7
  * | |
8
8
  * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
9
  * | v2.0 license and a commercial license which means that you're not bound by |
10
- * | the terms of the GPL. The commercial license is just �99 (GBP) and you can |
11
- * | read about it here: |
10
+ * | the terms of the GPL. The commercial license starts at just �99 (GBP) and |
11
+ * | you can read about it here: |
12
+ * | |
12
13
  * | http://www.rgraph.net/license |
13
14
  * o--------------------------------------------------------------------------------o
14
15
  */
@@ -0,0 +1,357 @@
1
+ // version: 2016-02-06
2
+ /**
3
+ * o--------------------------------------------------------------------------------o
4
+ * | This file is part of the RGraph package - you can learn more at: |
5
+ * | |
6
+ * | http://www.rgraph.net |
7
+ * | |
8
+ * | RGraph is dual licensed under the Open Source GPL (General Public License) |
9
+ * | v2.0 license and a commercial license which means that you're not bound by |
10
+ * | the terms of the GPL. The commercial license starts at just �99 (GBP) and |
11
+ * | you can read about it here: |
12
+ * | |
13
+ * | http://www.rgraph.net/license |
14
+ * o--------------------------------------------------------------------------------o
15
+ */
16
+
17
+ /**
18
+ * Initialise the various objects
19
+ */
20
+ RGraph = window.RGraph || {isRGraph: true};
21
+
22
+ // Module pattern
23
+ (function (win, doc, undefined)
24
+ {
25
+ RGraph.Sheets = function (key)
26
+ {
27
+ var worksheet,
28
+ callback,
29
+ letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
30
+
31
+ // 3 arguments
32
+ if (arguments.length === 3) {
33
+ worksheet = Number(arguments[1]);
34
+ callback = arguments[2];
35
+
36
+ // 2 arguments
37
+ } else {
38
+ worksheet = 1;
39
+ callback = arguments[1];
40
+ }
41
+
42
+ var url = 'https://spreadsheets.google.com/feeds/cells/[KEY]/[WORKSHEET]/public/full?alt=json-in-script&callback=__rgraph_JSONPCallback'.replace(/\[KEY\]/, key).replace(/\[WORKSHEET\]/, worksheet);
43
+
44
+ /*
45
+ * https://spreadsheets.google.com/feeds/cells/1q_BMjvKO_kKbAO3VjoaITSDyrLAk8f0SK5UFMmE3oRs/2/public/full?alt=json-in-script
46
+ */
47
+
48
+
49
+
50
+
51
+
52
+ //
53
+ // Loads the spreadsheet
54
+ //
55
+ this.load = function(url, userCallback)
56
+ {
57
+ var obj = this;
58
+
59
+ // A global on purpose
60
+ __rgraph_JSONPCallback = function (json)
61
+ {
62
+ // Save the JSON on the RGraph.Sheets object
63
+ obj.json = json;
64
+
65
+ //
66
+ // Put the entries in the JSON feed into a grid
67
+ //
68
+ var grid = [], row = 0, col = 0;
69
+
70
+ for (var i=0; i<json.feed.entry.length; ++i) {
71
+
72
+ row = json.feed.entry[i].gs$cell.row - 1;
73
+ col = json.feed.entry[i].gs$cell.col - 1;
74
+
75
+ if (!grid[row]) {
76
+ grid[row] = [];
77
+ }
78
+
79
+ grid[row][col] = json.feed.entry[i].content.$t;
80
+ }
81
+
82
+
83
+ //
84
+ // Determine the longest row
85
+ //
86
+ var maxcols = 0; // The max length of the rows
87
+
88
+ for (var i=0; i<grid.length; ++i) {
89
+ maxcols = grid[i] ? Math.max(maxcols, grid[i].length) : maxcols;
90
+ }
91
+
92
+
93
+
94
+ //
95
+ // Now go through the array and fill in any blank holes.
96
+ //
97
+ for (var i=0; i<grid.length; ++i) {
98
+
99
+ if (typeof grid[i] === 'undefined') {
100
+ grid[i] = new Array(maxcols);
101
+ }
102
+
103
+ for (var j=0; j<maxcols; j++) {
104
+ if (typeof grid[i][j] === 'undefined') {
105
+ grid[i][j] = '';
106
+ }
107
+
108
+ // Convert numbers to real numbers and floats here too
109
+ if (grid[i][j].match(/^[0-9]+$/)) {
110
+ grid[i][j] = parseInt(grid[i][j]);
111
+ } else if (grid[i][j].match(/^[0-9.]+$/)) {
112
+ grid[i][j] = parseFloat(grid[i][j]);
113
+ }
114
+ }
115
+ }
116
+
117
+ //
118
+ // Save the grid on the object
119
+ //
120
+ obj.data = grid;
121
+
122
+
123
+
124
+ //
125
+ // Call the users callback function. Users can access the raw data if
126
+ // they want with the obj.data property or by using the accessor
127
+ // methods (better)
128
+ //
129
+ userCallback(obj);
130
+ };
131
+
132
+ // Add the new script tag to the document that pulls in the JSON
133
+ //
134
+ // With jQuery...
135
+ //
136
+ //$('body').append("<script src='" + url + "'></script>");
137
+ //
138
+ // And without jQuery...
139
+
140
+ var scriptNode = document.createElement('SCRIPT');
141
+ scriptNode.src = url;
142
+ document.body.appendChild(scriptNode);
143
+ };
144
+
145
+
146
+
147
+
148
+ //
149
+ // Fetches a row of data and returns it
150
+ //
151
+ // @param id number The numeric index of the column to fetch (starts at 1)
152
+ // @param start number The index to start fetching/returning at. The first
153
+ // character is 1
154
+ // @param opt An option object containing options
155
+ //
156
+ this.row = function (index, start)
157
+ {
158
+ var opt = {}, row;
159
+
160
+ // Default for start is 1
161
+ start = start || 1;
162
+
163
+ //
164
+ // Parse the .trim argument
165
+ //
166
+
167
+ if (arguments && typeof arguments[2] === 'object' && typeof arguments[2].trim === 'boolean') {
168
+ opt.trim = arguments[2].trim;
169
+ } else {
170
+ opt.trim = true;
171
+ }
172
+
173
+ row = this.data[index - 1].slice(start - 1);
174
+
175
+ // Trim the array if required
176
+ if (opt.trim) {
177
+ row = RGraph.arrayTrim(row);
178
+ }
179
+
180
+ return row;
181
+ };
182
+
183
+
184
+
185
+ //
186
+ // Fetches a column of data and returns it
187
+ //
188
+ // @param id number The letter that corresponds to the column
189
+ // @param start number The index to start fetching/returning at. The first
190
+ // character is 1
191
+ // @param opt An option object containing options
192
+ //
193
+ this.col = function (index, start)
194
+ {
195
+ var opt = {},
196
+ col = [];
197
+
198
+ // Default for start is 1
199
+ start = start || 1;
200
+
201
+ if (arguments && typeof arguments[2] === 'object' && typeof arguments[2].trim === 'boolean') {
202
+ opt.trim = arguments[2].trim;
203
+ } else {
204
+ opt.trim = true;
205
+ }
206
+
207
+ for (var i=0; i<this.data.length; ++i) {
208
+ col.push(this.data[i][index - 1]);
209
+ }
210
+
211
+ // Trim the array if required
212
+ if (opt.trim) {
213
+ col = RGraph.arrayTrim(col);
214
+ }
215
+
216
+ // Now account for the start index
217
+
218
+ col = col.slice(start - 1);
219
+
220
+ return col;
221
+ };
222
+
223
+
224
+
225
+ //
226
+ // Returns the index (zero index) of the given letters
227
+ //
228
+ this.getIndexOfLetters = function (l)
229
+ {
230
+ var parts = l.split('');
231
+
232
+ if (parts.length === 1) {
233
+ return letters.indexOf(l) + 1;
234
+ } else if (parts.length === 2){
235
+ var idx = ((letters.indexOf(parts[0]) + 1) * 26) + (letters.indexOf(parts[1]) + 1);
236
+ return idx;
237
+ }
238
+ }
239
+
240
+
241
+
242
+
243
+
244
+ //
245
+ // The get method makes retrieving cells very straightforward,
246
+ // for example: obj.get('B1');
247
+ //
248
+ // @param str string The cells(s) to fetch
249
+ // @param string Optional set of options that are passed
250
+ // to the relevant row/col function
251
+ //
252
+ this.get = function (str)
253
+ {
254
+ // Uppercase letters please!
255
+ str = str.toUpperCase();
256
+
257
+ //
258
+ // Handle the style of .get('C') or .get('AA'
259
+ //
260
+ if (str.match(/^[a-z]+$/i)) {
261
+ if (str.length === 1) {
262
+ var index = letters.indexOf(str) + 1;
263
+ return this.col(index, 1, arguments[1]);
264
+
265
+ } else if (str.length === 2) {
266
+ var index = ((letters.indexOf(str[0]) + 1) * 26) + letters.indexOf(str[1]) + 1;
267
+ return this.col(index, 1, arguments[1]);
268
+ }
269
+ }
270
+
271
+
272
+
273
+
274
+ //
275
+ // Handle the style of .get('2');
276
+ //(fetching a whole row
277
+ //
278
+ if (str.match(/^[0-9]+$/i)) {
279
+ return this.row(str, null, arguments[1]);
280
+ }
281
+
282
+
283
+
284
+
285
+ //
286
+ // Handle the style of .get('E2');
287
+ //(fetching a single cell)
288
+ //
289
+ if (str.match(/^([a-z]{1,2})([0-9]+)$/i)) {
290
+
291
+ var letter = RegExp.$1,
292
+ number = RegExp.$2,
293
+ col = this.get(letter, {trim: false});
294
+
295
+
296
+ return col[number - 1];
297
+ }
298
+
299
+
300
+
301
+
302
+ //
303
+ // Handle the style of .get('B2:E2');
304
+ //(fetching the E2 cell to the E2 cell)
305
+ //
306
+ if (str.match(/^([a-z]{1,2})([0-9]+):([a-z]{1,2})([0-9]+)$/i)) {
307
+
308
+ var letter1 = RegExp.$1,
309
+ number1 = RegExp.$2,
310
+ letter2 = RegExp.$3,
311
+ number2 = RegExp.$4
312
+
313
+
314
+ if (letter1 === letter2) {
315
+ var cells = [],
316
+ index = this.getIndexOfLetters(letter1),
317
+ col = this.col(index, null, {trim: false});
318
+
319
+ for (var i=(number1 - 1); i<=(number2 - 1); ++i) {
320
+ cells.push(col[i]);
321
+ }
322
+
323
+ } else if (number1 === number2) {
324
+
325
+ var cells = [],
326
+ row = this.row(number1, null, {trim: false}),
327
+ index1 = this.getIndexOfLetters(letter1),
328
+ index2 = this.getIndexOfLetters(letter2)
329
+
330
+ for (var i=(index1 - 1); i<=(index2 - 1); ++i) {
331
+ cells.push(row[i]);
332
+ }
333
+ }
334
+
335
+ // Trim the results
336
+ if (arguments[1] && arguments[1].trim === false) {
337
+ // Nada
338
+ } else {
339
+ cells = RGraph.arrayTrim(cells);
340
+ }
341
+
342
+ return cells;
343
+
344
+ }
345
+ };
346
+
347
+
348
+
349
+
350
+ //
351
+ // Load the data
352
+ //
353
+ this.load(url, callback);
354
+ };
355
+
356
+ // End module pattern
357
+ })(window, document);