jquery_cheats 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -2
- data/app/assets/javascripts/jqueryCheats.js +36 -1
- data/jquery_cheats.gemspec +2 -2
- data/lib/jquery_cheats.rb +4 -0
- data/vendor/assets/excanvas.js +1438 -0
- data/vendor/assets/jquery.jqplot.css +259 -0
- data/vendor/assets/jquery.jqplot.js +10901 -0
- data/vendor/assets/plugins/jqplot.BezierCurveRenderer.js +312 -0
- data/vendor/assets/plugins/jqplot.BezierCurveRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.barRenderer.js +747 -0
- data/vendor/assets/plugins/jqplot.barRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.blockRenderer.js +234 -0
- data/vendor/assets/plugins/jqplot.blockRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.bubbleRenderer.js +754 -0
- data/vendor/assets/plugins/jqplot.bubbleRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.canvasAxisLabelRenderer.js +202 -0
- data/vendor/assets/plugins/jqplot.canvasAxisLabelRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.canvasAxisTickRenderer.js +242 -0
- data/vendor/assets/plugins/jqplot.canvasAxisTickRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.canvasOverlay.js +864 -0
- data/vendor/assets/plugins/jqplot.canvasOverlay.min.js +57 -0
- data/vendor/assets/plugins/jqplot.canvasTextRenderer.js +448 -0
- data/vendor/assets/plugins/jqplot.canvasTextRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.categoryAxisRenderer.js +636 -0
- data/vendor/assets/plugins/jqplot.categoryAxisRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.ciParser.js +115 -0
- data/vendor/assets/plugins/jqplot.ciParser.min.js +57 -0
- data/vendor/assets/plugins/jqplot.cursor.js +1093 -0
- data/vendor/assets/plugins/jqplot.cursor.min.js +57 -0
- data/vendor/assets/plugins/jqplot.dateAxisRenderer.js +702 -0
- data/vendor/assets/plugins/jqplot.dateAxisRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.donutRenderer.js +800 -0
- data/vendor/assets/plugins/jqplot.donutRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.dragable.js +224 -0
- data/vendor/assets/plugins/jqplot.dragable.min.js +57 -0
- data/vendor/assets/plugins/jqplot.enhancedLegendRenderer.js +241 -0
- data/vendor/assets/plugins/jqplot.enhancedLegendRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.funnelRenderer.js +938 -0
- data/vendor/assets/plugins/jqplot.funnelRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.highlighter.js +454 -0
- data/vendor/assets/plugins/jqplot.highlighter.min.js +57 -0
- data/vendor/assets/plugins/jqplot.json2.js +475 -0
- data/vendor/assets/plugins/jqplot.json2.min.js +57 -0
- data/vendor/assets/plugins/jqplot.logAxisRenderer.js +528 -0
- data/vendor/assets/plugins/jqplot.logAxisRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.mekkoAxisRenderer.js +610 -0
- data/vendor/assets/plugins/jqplot.mekkoAxisRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.mekkoRenderer.js +436 -0
- data/vendor/assets/plugins/jqplot.mekkoRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.meterGaugeRenderer.js +1029 -0
- data/vendor/assets/plugins/jqplot.meterGaugeRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.ohlcRenderer.js +372 -0
- data/vendor/assets/plugins/jqplot.ohlcRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.pieRenderer.js +899 -0
- data/vendor/assets/plugins/jqplot.pieRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.pointLabels.js +362 -0
- data/vendor/assets/plugins/jqplot.pointLabels.min.js +57 -0
- data/vendor/assets/plugins/jqplot.pyramidAxisRenderer.js +730 -0
- data/vendor/assets/plugins/jqplot.pyramidAxisRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.pyramidGridRenderer.js +423 -0
- data/vendor/assets/plugins/jqplot.pyramidGridRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.pyramidRenderer.js +490 -0
- data/vendor/assets/plugins/jqplot.pyramidRenderer.min.js +57 -0
- data/vendor/assets/plugins/jqplot.trendline.js +222 -0
- data/vendor/assets/plugins/jqplot.trendline.min.js +57 -0
- metadata +64 -3
@@ -0,0 +1,312 @@
|
|
1
|
+
/**
|
2
|
+
* jqPlot
|
3
|
+
* Pure JavaScript plotting plugin using jQuery
|
4
|
+
*
|
5
|
+
* Version: 1.0.0b2_r1012
|
6
|
+
*
|
7
|
+
* Copyright (c) 2009-2011 Chris Leonello
|
8
|
+
* jqPlot is currently available for use in all personal or commercial projects
|
9
|
+
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
10
|
+
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
11
|
+
* choose the license that best suits your project and use it accordingly.
|
12
|
+
*
|
13
|
+
* Although not required, the author would appreciate an email letting him
|
14
|
+
* know of any substantial use of jqPlot. You can reach the author at:
|
15
|
+
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
16
|
+
*
|
17
|
+
* If you are feeling kind and generous, consider supporting the project by
|
18
|
+
* making a donation at: http://www.jqplot.com/donate.php .
|
19
|
+
*
|
20
|
+
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
21
|
+
*
|
22
|
+
* version 2007.04.27
|
23
|
+
* author Ash Searle
|
24
|
+
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
25
|
+
* http://hexmen.com/js/sprintf.js
|
26
|
+
* The author (Ash Searle) has placed this code in the public domain:
|
27
|
+
* "This code is unrestricted: you are free to use it however you like."
|
28
|
+
*
|
29
|
+
*/
|
30
|
+
(function($) {
|
31
|
+
// Class: $.jqplot.BezierCurveRenderer.js
|
32
|
+
// Renderer which draws lines as stacked bezier curves.
|
33
|
+
// Data for the line will not be specified as an array of
|
34
|
+
// [x, y] data point values, but as a an array of [start piont, bezier curve]
|
35
|
+
// So, the line is specified as: [[xstart, ystart], [cp1x, cp1y, cp2x, cp2y, xend, yend]].
|
36
|
+
$.jqplot.BezierCurveRenderer = function(){
|
37
|
+
$.jqplot.LineRenderer.call(this);
|
38
|
+
};
|
39
|
+
|
40
|
+
$.jqplot.BezierCurveRenderer.prototype = new $.jqplot.LineRenderer();
|
41
|
+
$.jqplot.BezierCurveRenderer.prototype.constructor = $.jqplot.BezierCurveRenderer;
|
42
|
+
|
43
|
+
|
44
|
+
// Method: setGridData
|
45
|
+
// converts the user data values to grid coordinates and stores them
|
46
|
+
// in the gridData array.
|
47
|
+
// Called with scope of a series.
|
48
|
+
$.jqplot.BezierCurveRenderer.prototype.setGridData = function(plot) {
|
49
|
+
// recalculate the grid data
|
50
|
+
var xp = this._xaxis.series_u2p;
|
51
|
+
var yp = this._yaxis.series_u2p;
|
52
|
+
// this._plotData should be same as this.data
|
53
|
+
var data = this.data;
|
54
|
+
this.gridData = [];
|
55
|
+
this._prevGridData = [];
|
56
|
+
// if seriesIndex = 0, fill to x axis.
|
57
|
+
// if seriesIndex > 0, fill to previous series data.
|
58
|
+
var idx = this.index;
|
59
|
+
if (data.length == 2) {
|
60
|
+
if (idx == 0) {
|
61
|
+
this.gridData = [
|
62
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
63
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
64
|
+
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
65
|
+
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
66
|
+
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
67
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
68
|
+
];
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
var psd = plot.series[idx-1].data;
|
72
|
+
this.gridData = [
|
73
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
74
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
75
|
+
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
76
|
+
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
77
|
+
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
78
|
+
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
79
|
+
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
80
|
+
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
81
|
+
];
|
82
|
+
}
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
if (idx == 0) {
|
86
|
+
this.gridData = [
|
87
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
88
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
89
|
+
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
90
|
+
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
91
|
+
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
92
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
93
|
+
];
|
94
|
+
}
|
95
|
+
else {
|
96
|
+
var psd = plot.series[idx-1].data;
|
97
|
+
this.gridData = [
|
98
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
99
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
100
|
+
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
101
|
+
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
102
|
+
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
103
|
+
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
104
|
+
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
105
|
+
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
106
|
+
];
|
107
|
+
}
|
108
|
+
}
|
109
|
+
};
|
110
|
+
|
111
|
+
// Method: makeGridData
|
112
|
+
// converts any arbitrary data values to grid coordinates and
|
113
|
+
// returns them. This method exists so that plugins can use a series'
|
114
|
+
// linerenderer to generate grid data points without overwriting the
|
115
|
+
// grid data associated with that series.
|
116
|
+
// Called with scope of a series.
|
117
|
+
$.jqplot.BezierCurveRenderer.prototype.makeGridData = function(data, plot) {
|
118
|
+
// recalculate the grid data
|
119
|
+
var xp = this._xaxis.series_u2p;
|
120
|
+
var yp = this._yaxis.series_u2p;
|
121
|
+
var gd = [];
|
122
|
+
var pgd = [];
|
123
|
+
// if seriesIndex = 0, fill to x axis.
|
124
|
+
// if seriesIndex > 0, fill to previous series data.
|
125
|
+
var idx = this.index;
|
126
|
+
if (data.length == 2) {
|
127
|
+
if (idx == 0) {
|
128
|
+
gd = [
|
129
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
130
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
131
|
+
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
132
|
+
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
133
|
+
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
134
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
135
|
+
];
|
136
|
+
}
|
137
|
+
else {
|
138
|
+
var psd = plot.series[idx-1].data;
|
139
|
+
gd = [
|
140
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
141
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
142
|
+
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
143
|
+
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
144
|
+
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
145
|
+
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
146
|
+
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
147
|
+
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
148
|
+
];
|
149
|
+
}
|
150
|
+
}
|
151
|
+
else {
|
152
|
+
if (idx == 0) {
|
153
|
+
gd = [
|
154
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
155
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
156
|
+
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
157
|
+
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
158
|
+
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
159
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
160
|
+
];
|
161
|
+
}
|
162
|
+
else {
|
163
|
+
var psd = plot.series[idx-1].data;
|
164
|
+
gd = [
|
165
|
+
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
166
|
+
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
167
|
+
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
168
|
+
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
169
|
+
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
170
|
+
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
171
|
+
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
172
|
+
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
173
|
+
];
|
174
|
+
}
|
175
|
+
}
|
176
|
+
return gd;
|
177
|
+
};
|
178
|
+
|
179
|
+
|
180
|
+
// called within scope of series.
|
181
|
+
$.jqplot.BezierCurveRenderer.prototype.draw = function(ctx, gd, options) {
|
182
|
+
var i;
|
183
|
+
ctx.save();
|
184
|
+
if (gd.length) {
|
185
|
+
if (this.showLine) {
|
186
|
+
ctx.save();
|
187
|
+
var opts = (options != null) ? options : {};
|
188
|
+
ctx.fillStyle = opts.fillStyle || this.color;
|
189
|
+
ctx.beginPath();
|
190
|
+
ctx.moveTo(gd[0][0], gd[0][1]);
|
191
|
+
ctx.bezierCurveTo(gd[1][0], gd[1][1], gd[1][2], gd[1][3], gd[1][4], gd[1][5]);
|
192
|
+
ctx.lineTo(gd[2][0], gd[2][1]);
|
193
|
+
if (gd[3].length == 2) {
|
194
|
+
ctx.lineTo(gd[3][0], gd[3][1]);
|
195
|
+
}
|
196
|
+
else {
|
197
|
+
ctx.bezierCurveTo(gd[3][0], gd[3][1], gd[3][2], gd[3][3], gd[3][4], gd[3][5]);
|
198
|
+
}
|
199
|
+
ctx.closePath();
|
200
|
+
ctx.fill();
|
201
|
+
ctx.restore();
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
ctx.restore();
|
206
|
+
};
|
207
|
+
|
208
|
+
$.jqplot.BezierCurveRenderer.prototype.drawShadow = function(ctx, gd, options) {
|
209
|
+
// This is a no-op, shadows drawn with lines.
|
210
|
+
};
|
211
|
+
|
212
|
+
$.jqplot.BezierAxisRenderer = function() {
|
213
|
+
$.jqplot.LinearAxisRenderer.call(this);
|
214
|
+
};
|
215
|
+
|
216
|
+
$.jqplot.BezierAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
217
|
+
$.jqplot.BezierAxisRenderer.prototype.constructor = $.jqplot.BezierAxisRenderer;
|
218
|
+
|
219
|
+
|
220
|
+
// Axes on a plot with Bezier Curves
|
221
|
+
$.jqplot.BezierAxisRenderer.prototype.init = function(options){
|
222
|
+
$.extend(true, this, options);
|
223
|
+
var db = this._dataBounds;
|
224
|
+
// Go through all the series attached to this axis and find
|
225
|
+
// the min/max bounds for this axis.
|
226
|
+
for (var i=0; i<this._series.length; i++) {
|
227
|
+
var s = this._series[i];
|
228
|
+
var d = s.data;
|
229
|
+
if (d.length == 4) {
|
230
|
+
for (var j=0; j<d.length; j++) {
|
231
|
+
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
232
|
+
if (d[j][0] < db.min || db.min == null) {
|
233
|
+
db.min = d[j][0];
|
234
|
+
}
|
235
|
+
if (d[j][0] > db.max || db.max == null) {
|
236
|
+
db.max = d[j][0];
|
237
|
+
}
|
238
|
+
}
|
239
|
+
else {
|
240
|
+
if (d[j][1] < db.min || db.min == null) {
|
241
|
+
db.min = d[j][1];
|
242
|
+
}
|
243
|
+
if (d[j][1] > db.max || db.max == null) {
|
244
|
+
db.max = d[j][1];
|
245
|
+
}
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
251
|
+
if (d[0][0] < db.min || db.min == null) {
|
252
|
+
db.min = d[0][0];
|
253
|
+
}
|
254
|
+
if (d[0][0] > db.max || db.max == null) {
|
255
|
+
db.max = d[0][0];
|
256
|
+
}
|
257
|
+
for (var j=0; j<5; j+=2) {
|
258
|
+
if (d[1][j] < db.min || db.min == null) {
|
259
|
+
db.min = d[1][j];
|
260
|
+
}
|
261
|
+
if (d[1][j] > db.max || db.max == null) {
|
262
|
+
db.max = d[1][j];
|
263
|
+
}
|
264
|
+
}
|
265
|
+
}
|
266
|
+
else {
|
267
|
+
if (d[0][1] < db.min || db.min == null) {
|
268
|
+
db.min = d[0][1];
|
269
|
+
}
|
270
|
+
if (d[0][1] > db.max || db.max == null) {
|
271
|
+
db.max = d[0][1];
|
272
|
+
}
|
273
|
+
for (var j=1; j<6; j+=2) {
|
274
|
+
if (d[1][j] < db.min || db.min == null) {
|
275
|
+
db.min = d[1][j];
|
276
|
+
}
|
277
|
+
if (d[1][j] > db.max || db.max == null) {
|
278
|
+
db.max = d[1][j];
|
279
|
+
}
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
283
|
+
}
|
284
|
+
};
|
285
|
+
|
286
|
+
// setup default renderers for axes and legend so user doesn't have to
|
287
|
+
// called with scope of plot
|
288
|
+
function preInit(target, data, options) {
|
289
|
+
options = options || {};
|
290
|
+
options.axesDefaults = $.extend(true, {pad:0}, options.axesDefaults);
|
291
|
+
options.legend = $.extend(true, {placement:'outside'}, options.legend);
|
292
|
+
// only set these if there is a pie series
|
293
|
+
var setopts = false;
|
294
|
+
if (options.seriesDefaults.renderer == $.jqplot.BezierCurveRenderer) {
|
295
|
+
setopts = true;
|
296
|
+
}
|
297
|
+
else if (options.series) {
|
298
|
+
for (var i=0; i < options.series.length; i++) {
|
299
|
+
if (options.series[i].renderer == $.jqplot.BezierCurveRenderer) {
|
300
|
+
setopts = true;
|
301
|
+
}
|
302
|
+
}
|
303
|
+
}
|
304
|
+
|
305
|
+
if (setopts) {
|
306
|
+
options.axesDefaults.renderer = $.jqplot.BezierAxisRenderer;
|
307
|
+
}
|
308
|
+
}
|
309
|
+
|
310
|
+
$.jqplot.preInitHooks.push(preInit);
|
311
|
+
|
312
|
+
})(jQuery);
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/**
|
2
|
+
* jqPlot
|
3
|
+
* Pure JavaScript plotting plugin using jQuery
|
4
|
+
*
|
5
|
+
* Version: 1.0.0b2_r1012
|
6
|
+
*
|
7
|
+
* Copyright (c) 2009-2011 Chris Leonello
|
8
|
+
* jqPlot is currently available for use in all personal or commercial projects
|
9
|
+
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
10
|
+
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
11
|
+
* choose the license that best suits your project and use it accordingly.
|
12
|
+
*
|
13
|
+
* Although not required, the author would appreciate an email letting him
|
14
|
+
* know of any substantial use of jqPlot. You can reach the author at:
|
15
|
+
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
16
|
+
*
|
17
|
+
* If you are feeling kind and generous, consider supporting the project by
|
18
|
+
* making a donation at: http://www.jqplot.com/donate.php .
|
19
|
+
*
|
20
|
+
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
21
|
+
*
|
22
|
+
* version 2007.04.27
|
23
|
+
* author Ash Searle
|
24
|
+
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
25
|
+
* http://hexmen.com/js/sprintf.js
|
26
|
+
* The author (Ash Searle) has placed this code in the public domain:
|
27
|
+
* "This code is unrestricted: you are free to use it however you like."
|
28
|
+
*
|
29
|
+
* included jsDate library by Chris Leonello:
|
30
|
+
*
|
31
|
+
* Copyright (c) 2010-2011 Chris Leonello
|
32
|
+
*
|
33
|
+
* jsDate is currently available for use in all personal or commercial projects
|
34
|
+
* under both the MIT and GPL version 2.0 licenses. This means that you can
|
35
|
+
* choose the license that best suits your project and use it accordingly.
|
36
|
+
*
|
37
|
+
* jsDate borrows many concepts and ideas from the Date Instance
|
38
|
+
* Methods by Ken Snyder along with some parts of Ken's actual code.
|
39
|
+
*
|
40
|
+
* Ken's origianl Date Instance Methods and copyright notice:
|
41
|
+
*
|
42
|
+
* Ken Snyder (ken d snyder at gmail dot com)
|
43
|
+
* 2008-09-10
|
44
|
+
* version 2.0.2 (http://kendsnyder.com/sandbox/date/)
|
45
|
+
* Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
|
46
|
+
*
|
47
|
+
* jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
|
48
|
+
* Larry has generously given permission to adapt his code for inclusion
|
49
|
+
* into jqPlot.
|
50
|
+
*
|
51
|
+
* Larry's original code can be found here:
|
52
|
+
*
|
53
|
+
* https://github.com/lsiden/export-jqplot-to-png
|
54
|
+
*
|
55
|
+
*
|
56
|
+
*/
|
57
|
+
(function(b){b.jqplot.BezierCurveRenderer=function(){b.jqplot.LineRenderer.call(this)};b.jqplot.BezierCurveRenderer.prototype=new b.jqplot.LineRenderer();b.jqplot.BezierCurveRenderer.prototype.constructor=b.jqplot.BezierCurveRenderer;b.jqplot.BezierCurveRenderer.prototype.setGridData=function(h){var e=this._xaxis.series_u2p;var g=this._yaxis.series_u2p;var f=this.data;this.gridData=[];this._prevGridData=[];var d=this.index;if(f.length==2){if(d==0){this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[1][2]),g.call(this._yaxis,f[1][3]),e.call(this._xaxis,f[1][4]),g.call(this._yaxis,f[1][5])],[e.call(this._xaxis,f[1][4]),g.call(this._yaxis,this._yaxis.min)],[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,this._yaxis.min)]]}else{var c=h.series[d-1].data;this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[1][2]),g.call(this._yaxis,f[1][3]),e.call(this._xaxis,f[1][4]),g.call(this._yaxis,f[1][5])],[e.call(this._xaxis,c[1][4]),g.call(this._yaxis,c[1][5])],[e.call(this._xaxis,c[1][2]),g.call(this._yaxis,c[1][3]),e.call(this._xaxis,c[1][0]),g.call(this._yaxis,c[1][1]),e.call(this._xaxis,c[0][0]),g.call(this._yaxis,c[0][1])]]}}else{if(d==0){this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[2][0]),g.call(this._yaxis,f[2][1]),e.call(this._xaxis,f[3][0]),g.call(this._yaxis,f[3][1])],[e.call(this._xaxis,f[3][1]),g.call(this._yaxis,this._yaxis.min)],[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,this._yaxis.min)]]}else{var c=h.series[d-1].data;this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[2][0]),g.call(this._yaxis,f[2][1]),e.call(this._xaxis,f[3][0]),g.call(this._yaxis,f[3][1])],[e.call(this._xaxis,c[3][0]),g.call(this._yaxis,c[3][1])],[e.call(this._xaxis,c[2][0]),g.call(this._yaxis,c[2][1]),e.call(this._xaxis,c[1][0]),g.call(this._yaxis,c[1][1]),e.call(this._xaxis,c[0][0]),g.call(this._yaxis,c[0][1])]]}}};b.jqplot.BezierCurveRenderer.prototype.makeGridData=function(g,i){var f=this._xaxis.series_u2p;var h=this._yaxis.series_u2p;var e=[];var j=[];var d=this.index;if(g.length==2){if(d==0){e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[1][2]),h.call(this._yaxis,g[1][3]),f.call(this._xaxis,g[1][4]),h.call(this._yaxis,g[1][5])],[f.call(this._xaxis,g[1][4]),h.call(this._yaxis,this._yaxis.min)],[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,this._yaxis.min)]]}else{var c=i.series[d-1].data;e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[1][2]),h.call(this._yaxis,g[1][3]),f.call(this._xaxis,g[1][4]),h.call(this._yaxis,g[1][5])],[f.call(this._xaxis,c[1][4]),h.call(this._yaxis,c[1][5])],[f.call(this._xaxis,c[1][2]),h.call(this._yaxis,c[1][3]),f.call(this._xaxis,c[1][0]),h.call(this._yaxis,c[1][1]),f.call(this._xaxis,c[0][0]),h.call(this._yaxis,c[0][1])]]}}else{if(d==0){e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[2][0]),h.call(this._yaxis,g[2][1]),f.call(this._xaxis,g[3][0]),h.call(this._yaxis,g[3][1])],[f.call(this._xaxis,g[3][1]),h.call(this._yaxis,this._yaxis.min)],[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,this._yaxis.min)]]}else{var c=i.series[d-1].data;e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[2][0]),h.call(this._yaxis,g[2][1]),f.call(this._xaxis,g[3][0]),h.call(this._yaxis,g[3][1])],[f.call(this._xaxis,c[3][0]),h.call(this._yaxis,c[3][1])],[f.call(this._xaxis,c[2][0]),h.call(this._yaxis,c[2][1]),f.call(this._xaxis,c[1][0]),h.call(this._yaxis,c[1][1]),f.call(this._xaxis,c[0][0]),h.call(this._yaxis,c[0][1])]]}}return e};b.jqplot.BezierCurveRenderer.prototype.draw=function(c,g,d){var e;c.save();if(g.length){if(this.showLine){c.save();var f=(d!=null)?d:{};c.fillStyle=f.fillStyle||this.color;c.beginPath();c.moveTo(g[0][0],g[0][1]);c.bezierCurveTo(g[1][0],g[1][1],g[1][2],g[1][3],g[1][4],g[1][5]);c.lineTo(g[2][0],g[2][1]);if(g[3].length==2){c.lineTo(g[3][0],g[3][1])}else{c.bezierCurveTo(g[3][0],g[3][1],g[3][2],g[3][3],g[3][4],g[3][5])}c.closePath();c.fill();c.restore()}}c.restore()};b.jqplot.BezierCurveRenderer.prototype.drawShadow=function(c,e,d){};b.jqplot.BezierAxisRenderer=function(){b.jqplot.LinearAxisRenderer.call(this)};b.jqplot.BezierAxisRenderer.prototype=new b.jqplot.LinearAxisRenderer();b.jqplot.BezierAxisRenderer.prototype.constructor=b.jqplot.BezierAxisRenderer;b.jqplot.BezierAxisRenderer.prototype.init=function(f){b.extend(true,this,f);var c=this._dataBounds;for(var g=0;g<this._series.length;g++){var h=this._series[g];var k=h.data;if(k.length==4){for(var e=0;e<k.length;e++){if(this.name=="xaxis"||this.name=="x2axis"){if(k[e][0]<c.min||c.min==null){c.min=k[e][0]}if(k[e][0]>c.max||c.max==null){c.max=k[e][0]}}else{if(k[e][1]<c.min||c.min==null){c.min=k[e][1]}if(k[e][1]>c.max||c.max==null){c.max=k[e][1]}}}}else{if(this.name=="xaxis"||this.name=="x2axis"){if(k[0][0]<c.min||c.min==null){c.min=k[0][0]}if(k[0][0]>c.max||c.max==null){c.max=k[0][0]}for(var e=0;e<5;e+=2){if(k[1][e]<c.min||c.min==null){c.min=k[1][e]}if(k[1][e]>c.max||c.max==null){c.max=k[1][e]}}}else{if(k[0][1]<c.min||c.min==null){c.min=k[0][1]}if(k[0][1]>c.max||c.max==null){c.max=k[0][1]}for(var e=1;e<6;e+=2){if(k[1][e]<c.min||c.min==null){c.min=k[1][e]}if(k[1][e]>c.max||c.max==null){c.max=k[1][e]}}}}}};function a(g,f,d){d=d||{};d.axesDefaults=b.extend(true,{pad:0},d.axesDefaults);d.legend=b.extend(true,{placement:"outside"},d.legend);var c=false;if(d.seriesDefaults.renderer==b.jqplot.BezierCurveRenderer){c=true}else{if(d.series){for(var e=0;e<d.series.length;e++){if(d.series[e].renderer==b.jqplot.BezierCurveRenderer){c=true}}}}if(c){d.axesDefaults.renderer=b.jqplot.BezierAxisRenderer}}b.jqplot.preInitHooks.push(a)})(jQuery);
|