jquery_cheats 3.0.0 → 4.0.0

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 (69) hide show
  1. data/app/assets/javascripts/{jqueryCheats.js → jquery_cheats/jquery_cheats.js} +0 -0
  2. data/jquery_cheats.gemspec +1 -1
  3. data/lib/jquery_cheats/engine.rb +6 -0
  4. data/lib/{railtie.rb → jquery_cheats/railtie.rb} +0 -0
  5. data/lib/jquery_cheats.rb +2 -2
  6. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/excanvas.js +1438 -1438
  7. data/vendor/assets/javascripts/jquery_cheats/jqplot/index.js +1 -0
  8. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/jquery.jqplot.js +10901 -10901
  9. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.BezierCurveRenderer.js +311 -311
  10. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.BezierCurveRenderer.min.js +56 -56
  11. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.barRenderer.js +746 -746
  12. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.barRenderer.min.js +56 -56
  13. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.blockRenderer.js +233 -233
  14. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.blockRenderer.min.js +56 -56
  15. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.bubbleRenderer.js +753 -753
  16. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.bubbleRenderer.min.js +56 -56
  17. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisLabelRenderer.js +201 -201
  18. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisLabelRenderer.min.js +56 -56
  19. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisTickRenderer.js +241 -241
  20. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisTickRenderer.min.js +56 -56
  21. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasOverlay.js +863 -863
  22. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasOverlay.min.js +56 -56
  23. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasTextRenderer.js +447 -447
  24. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasTextRenderer.min.js +56 -56
  25. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.categoryAxisRenderer.js +635 -635
  26. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.categoryAxisRenderer.min.js +56 -56
  27. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ciParser.js +114 -114
  28. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ciParser.min.js +56 -56
  29. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.cursor.js +1092 -1092
  30. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.cursor.min.js +56 -56
  31. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dateAxisRenderer.js +702 -702
  32. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dateAxisRenderer.min.js +56 -56
  33. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.donutRenderer.js +799 -799
  34. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.donutRenderer.min.js +56 -56
  35. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dragable.js +223 -223
  36. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dragable.min.js +56 -56
  37. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.enhancedLegendRenderer.js +240 -240
  38. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.enhancedLegendRenderer.min.js +56 -56
  39. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.funnelRenderer.js +937 -937
  40. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.funnelRenderer.min.js +56 -56
  41. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.highlighter.js +453 -453
  42. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.highlighter.min.js +56 -56
  43. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.json2.js +475 -475
  44. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.json2.min.js +56 -56
  45. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.logAxisRenderer.js +527 -527
  46. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.logAxisRenderer.min.js +56 -56
  47. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoAxisRenderer.js +610 -610
  48. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoAxisRenderer.min.js +56 -56
  49. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoRenderer.js +435 -435
  50. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoRenderer.min.js +56 -56
  51. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.meterGaugeRenderer.js +1028 -1028
  52. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.meterGaugeRenderer.min.js +56 -56
  53. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ohlcRenderer.js +371 -371
  54. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ohlcRenderer.min.js +56 -56
  55. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pieRenderer.js +898 -898
  56. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pieRenderer.min.js +56 -56
  57. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pointLabels.js +361 -361
  58. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pointLabels.min.js +56 -56
  59. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidAxisRenderer.js +729 -729
  60. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidAxisRenderer.min.js +56 -56
  61. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidGridRenderer.js +422 -422
  62. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidGridRenderer.min.js +56 -56
  63. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidRenderer.js +489 -489
  64. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidRenderer.min.js +56 -56
  65. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.trendline.js +221 -221
  66. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.trendline.min.js +56 -56
  67. data/vendor/assets/stylesheets/{jquery.jqplot.css → jquery_cheats/jquery.jqplot.css} +259 -259
  68. metadata +68 -67
  69. data/lib/engine.rb +0 -7
@@ -1,312 +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
-
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
312
  })(jQuery);