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,276 +1,20 @@
|
|
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
|
-
this.url = url;
|
38
|
-
this.ready = func;
|
39
|
-
this.data = null;
|
40
|
-
this.numrows = null;
|
41
|
-
this.numcols = null;
|
42
|
-
this.seperator = arguments[2] || ',';
|
43
|
-
this.endofline = arguments[3] || /\r?\n/;
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
/**
|
49
|
-
* A Custom split function
|
50
|
-
*
|
51
|
-
* @param string str The CSV string to split
|
52
|
-
* @param mixed char The character to split on - or it can also be an object like this:
|
53
|
-
* {
|
54
|
-
* preserve: false, // Whether to preserve whitespace
|
55
|
-
* char: ',' // The character to split on
|
56
|
-
* }
|
57
|
-
*/
|
58
|
-
this.splitCSV = function (str, split)
|
59
|
-
{
|
60
|
-
// Defaults
|
61
|
-
var arr = [];
|
62
|
-
var field = '';
|
63
|
-
var inDoubleQuotes = false;
|
64
|
-
var inSingleQuotes = false;
|
65
|
-
var preserve = (typeof split === 'object' && split.preserve) ? true : false;
|
66
|
-
|
67
|
-
// The character to split the CSV string on
|
68
|
-
if (typeof split === 'object') {
|
69
|
-
if (typeof split.char === 'string') {
|
70
|
-
split = split.char;
|
71
|
-
} else {
|
72
|
-
split = ',';
|
73
|
-
}
|
74
|
-
} // If not an object just leave the char as it's supplied
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
for (var i=0,len=str.length; i<len; i+=1) {
|
79
|
-
|
80
|
-
char = str.charAt(i);
|
81
|
-
|
82
|
-
if ( (char === '"') && !inDoubleQuotes) {
|
83
|
-
inDoubleQuotes = true;
|
84
|
-
continue;
|
85
|
-
|
86
|
-
} else if ( (char === '"') && inDoubleQuotes) {
|
87
|
-
inDoubleQuotes = false;
|
88
|
-
continue;
|
89
|
-
}
|
90
|
-
if ( (char === "'") && !inSingleQuotes) {
|
91
|
-
inSingleQuotes = true;
|
92
|
-
continue;
|
93
|
-
|
94
|
-
} else if ( (char === "'") && inSingleQuotes) {
|
95
|
-
inSingleQuotes = false;
|
96
|
-
continue;
|
97
|
-
|
98
|
-
} else if (char === split && !inDoubleQuotes && !inSingleQuotes) {
|
99
|
-
// TODO look ahead in order to allow for multi-character seperators
|
100
|
-
arr.push(field);
|
101
|
-
field = '';
|
102
|
-
continue;
|
103
|
-
|
104
|
-
} else {
|
105
|
-
field = field + char;
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
// Add the last field
|
110
|
-
arr.push(field);
|
111
|
-
|
112
|
-
// Now trim each value if necessary
|
113
|
-
if (!preserve) {
|
114
|
-
for (i=0,len=arr.length; i<len; i+=1) {
|
115
|
-
arr[i] = arr[i].trim();
|
116
|
-
}
|
117
|
-
}
|
118
|
-
|
119
|
-
return arr;
|
120
|
-
};
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
/**
|
126
|
-
* This function splits the CSV data into an array so that it can be useful.
|
127
|
-
*/
|
128
|
-
this.fetch = function ()
|
129
|
-
{
|
130
|
-
var sep = this.seperator;
|
131
|
-
var eol = this.endofline;
|
132
|
-
var obj = this;
|
133
|
-
|
134
|
-
if (this.url.substring(0,3) == 'id:') {
|
135
|
-
|
136
|
-
// Get rid of any surrounding whitespace
|
137
|
-
var data = document.getElementById(this.url.substring(3)).innerHTML.trim();
|
138
|
-
|
139
|
-
// Store the CSV data on the CSV object (ie - this object)
|
140
|
-
obj.data = data.split(eol);
|
141
|
-
|
142
|
-
// Store the number of rows
|
143
|
-
obj.numrows = obj.data.length;
|
144
|
-
|
145
|
-
for (var i=0,len=obj.data.length; i<len; i+=1) {
|
146
|
-
|
147
|
-
|
148
|
-
/**
|
149
|
-
* Split the individual line
|
150
|
-
*/
|
151
|
-
//var row = obj.data[i].split(sep);
|
152
|
-
var row = obj.splitCSV(obj.data[i], {preserve: false, char: sep});
|
153
|
-
|
154
|
-
|
155
|
-
if (!obj.numcols) {
|
156
|
-
obj.numcols = row.length;
|
157
|
-
}
|
158
|
-
|
159
|
-
/**
|
160
|
-
* If the cell is purely made up of numbers - convert it
|
161
|
-
*/
|
162
|
-
for (var j=0; j<row.length; j+=1) {
|
163
|
-
if ((/^[0-9.]+$/).test(row[j])) {
|
164
|
-
row[j] = parseFloat(row[j]);
|
165
|
-
}
|
166
|
-
|
167
|
-
// Assign the split-up-row back to the data array
|
168
|
-
obj.data[i] = row;
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
// Call the ready function straight away
|
173
|
-
obj.ready(obj);
|
174
|
-
|
175
|
-
} else {
|
176
|
-
|
177
|
-
RGraph.AJAX.getString(this.url, function (data)
|
178
|
-
{
|
179
|
-
data = data.replace(/(\r?\n)+$/, '');
|
180
|
-
|
181
|
-
/**
|
182
|
-
* Split the lines in the CSV
|
183
|
-
*/
|
184
|
-
obj.data = data.split(eol);
|
185
|
-
|
186
|
-
/**
|
187
|
-
* Store the number of rows
|
188
|
-
*/
|
189
|
-
obj.numrows = obj.data.length;
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
/**
|
194
|
-
* Loop thru each lines in the CSV file
|
195
|
-
*/
|
196
|
-
for (var i=0,len=obj.data.length; i<len; i+=1) {
|
197
|
-
/**
|
198
|
-
* Use the new split function to split each row NOT preserving whitespace
|
199
|
-
*/
|
200
|
-
//var row = obj.data[i].split(sep);
|
201
|
-
var row = obj.splitCSV(obj.data[i], {preserve: false, char: sep});
|
202
|
-
|
203
|
-
if (!obj.numcols) {
|
204
|
-
obj.numcols = row.length;
|
205
|
-
}
|
206
|
-
|
207
|
-
/**
|
208
|
-
* If the cell is purely made up of numbers - convert it
|
209
|
-
*/
|
210
|
-
for (var j=0; j<row.length; j+=1) {
|
211
|
-
if ((/^\-?[0-9.]+$/).test(row[j])) {
|
212
|
-
row[j] = parseFloat(row[j]);
|
213
|
-
}
|
214
|
-
|
215
|
-
// Assign the split-up-row back to the data array
|
216
|
-
obj.data[i] = row;
|
217
|
-
}
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
// Call the ready function straight away
|
222
|
-
obj.ready(obj);
|
223
|
-
});
|
224
|
-
}
|
225
|
-
};
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
/**
|
231
|
-
* Returns a row of the CSV file
|
232
|
-
*
|
233
|
-
* @param number index The index of the row to fetch
|
234
|
-
* @param start OPTIONAL If desired you can specify a column to start at (which starts at 0 by default)
|
235
|
-
*/
|
236
|
-
this.getRow = function (index)
|
237
|
-
{
|
238
|
-
var row = [];
|
239
|
-
var start = arguments[1] || 0;
|
240
|
-
|
241
|
-
for (var i=start; i<this.numcols; i+=1) {
|
242
|
-
row.push(this.data[index][i]);
|
243
|
-
}
|
244
|
-
|
245
|
-
return row;
|
246
|
-
};
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
/**
|
252
|
-
* Returns a column of the CSV file
|
253
|
-
*
|
254
|
-
* @param number index The index of the column to fetch
|
255
|
-
* @param start OPTIONAL If desired you can specify a row to start at (which starts at 0 by default)
|
256
|
-
*/
|
257
|
-
this.getCol =
|
258
|
-
this.getColumn = function (index)
|
259
|
-
{
|
260
|
-
var col = [];
|
261
|
-
var start = arguments[1] || 0;
|
262
|
-
|
263
|
-
for (var i=start; i<this.numrows; i+=1) {
|
264
|
-
col.push(this.data[i][index]);
|
265
|
-
}
|
266
|
-
|
267
|
-
return col;
|
268
|
-
};
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
// Fetch the CSV file
|
275
|
-
this.fetch();
|
276
|
-
};
|
2
|
+
RGraph=window.RGraph||{isRGraph:true};RGraph.CSV=function(url,func)
|
3
|
+
{var RG=RGraph,ua=navigator.userAgent,ma=Math;this.url=url;this.ready=func;this.data=null;this.numrows=null;this.numcols=null;this.seperator=arguments[2]||',';this.endofline=arguments[3]||/\r?\n/;this.splitCSV=function(str,split)
|
4
|
+
{var arr=[];var field='';var inDoubleQuotes=false;var inSingleQuotes=false;var preserve=(typeof split==='object'&&split.preserve)?true:false;if(typeof split==='object'){if(typeof split.char==='string'){split=split.char;}else{split=',';}}
|
5
|
+
for(var i=0,len=str.length;i<len;i+=1){char=str.charAt(i);if((char==='"')&&!inDoubleQuotes){inDoubleQuotes=true;continue;}else if((char==='"')&&inDoubleQuotes){inDoubleQuotes=false;continue;}
|
6
|
+
if((char==="'")&&!inSingleQuotes){inSingleQuotes=true;continue;}else if((char==="'")&&inSingleQuotes){inSingleQuotes=false;continue;}else if(char===split&&!inDoubleQuotes&&!inSingleQuotes){arr.push(field);field='';continue;}else{field=field+char;}}
|
7
|
+
arr.push(field);if(!preserve){for(i=0,len=arr.length;i<len;i+=1){arr[i]=arr[i].trim();}}
|
8
|
+
return arr;};this.fetch=function()
|
9
|
+
{var sep=this.seperator;var eol=this.endofline;var obj=this;if(this.url.substring(0,3)=='id:'){var data=document.getElementById(this.url.substring(3)).innerHTML.trim();obj.data=data.split(eol);obj.numrows=obj.data.length;for(var i=0,len=obj.data.length;i<len;i+=1){var row=obj.splitCSV(obj.data[i],{preserve:false,char:sep});if(!obj.numcols){obj.numcols=row.length;}
|
10
|
+
for(var j=0;j<row.length;j+=1){if((/^[0-9.]+$/).test(row[j])){row[j]=parseFloat(row[j]);}
|
11
|
+
obj.data[i]=row;}}
|
12
|
+
obj.ready(obj);}else{RGraph.AJAX.getString(this.url,function(data)
|
13
|
+
{data=data.replace(/(\r?\n)+$/,'');obj.data=data.split(eol);obj.numrows=obj.data.length;for(var i=0,len=obj.data.length;i<len;i+=1){var row=obj.splitCSV(obj.data[i],{preserve:false,char:sep});if(!obj.numcols){obj.numcols=row.length;}
|
14
|
+
for(var j=0;j<row.length;j+=1){if((/^\-?[0-9.]+$/).test(row[j])){row[j]=parseFloat(row[j]);}
|
15
|
+
obj.data[i]=row;}}
|
16
|
+
obj.ready(obj);});}};this.getRow=function(index)
|
17
|
+
{var row=[];var start=arguments[1]||0;for(var i=start;i<this.numcols;i+=1){row.push(this.data[index][i]);}
|
18
|
+
return row;};this.getCol=this.getColumn=function(index)
|
19
|
+
{var col=[];var start=arguments[1]||0;for(var i=start;i<this.numrows;i+=1){col.push(this.data[i][index]);}
|
20
|
+
return col;};this.fetch();};
|