rgraph-rails 1.0.5 → 1.0.6
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.
- checksums.yaml +8 -8
- data/.travis.yml +0 -1
- data/README.md +3 -3
- data/lib/rgraph-rails/version.rb +1 -1
- data/vendor/assets/javascripts/RGraph.bar.js +239 -3764
- data/vendor/assets/javascripts/RGraph.bipolar.js +115 -1986
- data/vendor/assets/javascripts/RGraph.common.annotate.js +35 -399
- data/vendor/assets/javascripts/RGraph.common.context.js +30 -600
- data/vendor/assets/javascripts/RGraph.common.core.js +403 -5187
- data/vendor/assets/javascripts/RGraph.common.csv.js +19 -275
- data/vendor/assets/javascripts/RGraph.common.deprecated.js +35 -454
- data/vendor/assets/javascripts/RGraph.common.dynamic.js +84 -1189
- data/vendor/assets/javascripts/RGraph.common.effects.js +90 -1548
- data/vendor/assets/javascripts/RGraph.common.key.js +54 -755
- data/vendor/assets/javascripts/RGraph.common.resizing.js +37 -567
- data/vendor/assets/javascripts/RGraph.common.sheets.js +29 -356
- data/vendor/assets/javascripts/RGraph.common.tooltips.js +32 -614
- data/vendor/assets/javascripts/RGraph.common.zoom.js +14 -223
- data/vendor/assets/javascripts/RGraph.cornergauge.js +71 -0
- data/vendor/assets/javascripts/RGraph.drawing.background.js +35 -620
- data/vendor/assets/javascripts/RGraph.drawing.circle.js +35 -576
- data/vendor/assets/javascripts/RGraph.drawing.image.js +52 -807
- data/vendor/assets/javascripts/RGraph.drawing.marker1.js +41 -717
- data/vendor/assets/javascripts/RGraph.drawing.marker2.js +37 -668
- data/vendor/assets/javascripts/RGraph.drawing.marker3.js +36 -563
- data/vendor/assets/javascripts/RGraph.drawing.poly.js +40 -608
- data/vendor/assets/javascripts/RGraph.drawing.rect.js +35 -597
- data/vendor/assets/javascripts/RGraph.drawing.text.js +34 -642
- data/vendor/assets/javascripts/RGraph.drawing.xaxis.js +50 -809
- data/vendor/assets/javascripts/RGraph.drawing.yaxis.js +51 -856
- data/vendor/assets/javascripts/RGraph.fuel.js +58 -964
- data/vendor/assets/javascripts/RGraph.funnel.js +55 -984
- data/vendor/assets/javascripts/RGraph.gantt.js +75 -1241
- data/vendor/assets/javascripts/RGraph.gauge.js +87 -1397
- data/vendor/assets/javascripts/RGraph.hbar.js +143 -2376
- data/vendor/assets/javascripts/RGraph.hprogress.js +80 -1397
- data/vendor/assets/javascripts/RGraph.line.js +241 -4162
- data/vendor/assets/javascripts/RGraph.meter.js +74 -1278
- metadata +3 -30
- data/vendor/assets/images/bg.png +0 -0
- data/vendor/assets/images/bullet.png +0 -0
- data/vendor/assets/images/facebook-large.png +0 -0
- data/vendor/assets/images/google-plus-large.png +0 -0
- data/vendor/assets/images/logo.png +0 -0
- data/vendor/assets/images/meter-image-sd-needle.png +0 -0
- data/vendor/assets/images/meter-image-sd.png +0 -0
- data/vendor/assets/images/meter-sketch-needle.png +0 -0
- data/vendor/assets/images/meter-sketch.png +0 -0
- data/vendor/assets/images/odometer-background.png +0 -0
- data/vendor/assets/images/rgraph.jpg +0 -0
- data/vendor/assets/images/title.png +0 -0
- data/vendor/assets/images/twitter-large.png +0 -0
- data/vendor/assets/javascripts/RGraph.modaldialog.js +0 -301
- data/vendor/assets/javascripts/RGraph.odo.js +0 -1265
- data/vendor/assets/javascripts/RGraph.pie.js +0 -2272
- data/vendor/assets/javascripts/RGraph.radar.js +0 -1847
- data/vendor/assets/javascripts/RGraph.rose.js +0 -1877
- data/vendor/assets/javascripts/RGraph.rscatter.js +0 -1425
- data/vendor/assets/javascripts/RGraph.scatter.js +0 -2970
- data/vendor/assets/javascripts/RGraph.semicircularprogress.js +0 -1015
- data/vendor/assets/javascripts/RGraph.thermometer.js +0 -1129
- data/vendor/assets/javascripts/RGraph.vprogress.js +0 -1452
- data/vendor/assets/javascripts/RGraph.waterfall.js +0 -1252
- data/vendor/assets/javascripts/financial-data.js +0 -1067
- data/vendor/assets/stylesheets/ModalDialog.css +0 -90
- data/vendor/assets/stylesheets/animations.css +0 -3347
- data/vendor/assets/stylesheets/website.css +0 -446
@@ -1,357 +1,30 @@
|
|
1
|
-
// version: 2016-06-04
|
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
1
|
|
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
|
-
// 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);
|
2
|
+
RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined)
|
3
|
+
{RGraph.Sheets=function(key)
|
4
|
+
{var worksheet,callback,letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ';if(arguments.length===3){worksheet=Number(arguments[1]);callback=arguments[2];}else{worksheet=1;callback=arguments[1];}
|
5
|
+
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);this.load=function(url,userCallback)
|
6
|
+
{var obj=this;__rgraph_JSONPCallback=function(json)
|
7
|
+
{obj.json=json;var grid=[],row=0,col=0;for(var i=0;i<json.feed.entry.length;++i){row=json.feed.entry[i].gs$cell.row-1;col=json.feed.entry[i].gs$cell.col-1;if(!grid[row]){grid[row]=[];}
|
8
|
+
grid[row][col]=json.feed.entry[i].content.$t;}
|
9
|
+
var maxcols=0;for(var i=0;i<grid.length;++i){maxcols=grid[i]?Math.max(maxcols,grid[i].length):maxcols;}
|
10
|
+
for(var i=0;i<grid.length;++i){if(typeof grid[i]==='undefined'){grid[i]=new Array(maxcols);}
|
11
|
+
for(var j=0;j<maxcols;j++){if(typeof grid[i][j]==='undefined'){grid[i][j]='';}
|
12
|
+
if(grid[i][j].match(/^[0-9]+$/)){grid[i][j]=parseInt(grid[i][j]);}else if(grid[i][j].match(/^[0-9.]+$/)){grid[i][j]=parseFloat(grid[i][j]);}}}
|
13
|
+
obj.data=grid;userCallback(obj);};var scriptNode=document.createElement('SCRIPT');scriptNode.src=url;document.body.appendChild(scriptNode);};this.row=function(index,start)
|
14
|
+
{var opt={},row;start=start||1;if(arguments&&typeof arguments[2]==='object'&&typeof arguments[2].trim==='boolean'){opt.trim=arguments[2].trim;}else{opt.trim=true;}
|
15
|
+
row=this.data[index-1].slice(start-1);if(opt.trim){row=RGraph.arrayTrim(row);}
|
16
|
+
return row;};this.col=function(index,start)
|
17
|
+
{var opt={},col=[];start=start||1;if(arguments&&typeof arguments[2]==='object'&&typeof arguments[2].trim==='boolean'){opt.trim=arguments[2].trim;}else{opt.trim=true;}
|
18
|
+
for(var i=0;i<this.data.length;++i){col.push(this.data[i][index-1]);}
|
19
|
+
if(opt.trim){col=RGraph.arrayTrim(col);}
|
20
|
+
col=col.slice(start-1);return col;};this.getIndexOfLetters=function(l)
|
21
|
+
{var parts=l.split('');if(parts.length===1){return letters.indexOf(l)+1;}else if(parts.length===2){var idx=((letters.indexOf(parts[0])+1)*26)+(letters.indexOf(parts[1])+1);return idx;}}
|
22
|
+
this.get=function(str)
|
23
|
+
{str=str.toUpperCase();if(str.match(/^[a-z]+$/i)){if(str.length===1){var index=letters.indexOf(str)+1;return this.col(index,1,arguments[1]);}else if(str.length===2){var index=((letters.indexOf(str[0])+1)*26)+letters.indexOf(str[1])+1;return this.col(index,1,arguments[1]);}}
|
24
|
+
if(str.match(/^[0-9]+$/i)){return this.row(str,null,arguments[1]);}
|
25
|
+
if(str.match(/^([a-z]{1,2})([0-9]+)$/i)){var letter=RegExp.$1,number=RegExp.$2,col=this.get(letter,{trim:false});return col[number-1];}
|
26
|
+
if(str.match(/^([a-z]{1,2})([0-9]+):([a-z]{1,2})([0-9]+)$/i)){var letter1=RegExp.$1,number1=RegExp.$2,letter2=RegExp.$3,number2=RegExp.$4
|
27
|
+
if(letter1===letter2){var cells=[],index=this.getIndexOfLetters(letter1),col=this.col(index,null,{trim:false});for(var i=(number1-1);i<=(number2-1);++i){cells.push(col[i]);}}else if(number1===number2){var cells=[],row=this.row(number1,null,{trim:false}),index1=this.getIndexOfLetters(letter1),index2=this.getIndexOfLetters(letter2)
|
28
|
+
for(var i=(index1-1);i<=(index2-1);++i){cells.push(row[i]);}}
|
29
|
+
if(arguments[1]&&arguments[1].trim===false){}else{cells=RGraph.arrayTrim(cells);}
|
30
|
+
return cells;}};this.load(url,callback);};})(window,document);
|