jquery_cheats 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,57 +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
- */
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
57
  (function(d){d.jqplot.Dragable=function(g){this.markerRenderer=new d.jqplot.MarkerRenderer({shadow:false});this.shapeRenderer=new d.jqplot.ShapeRenderer();this.isDragging=false;this.isOver=false;this._ctx;this._elem;this._point;this._gridData;this.color;this.constrainTo="none";d.extend(true,this,g)};function b(){d.jqplot.GenericCanvas.call(this);this.isDragging=false;this.isOver=false;this._neighbor;this._cursors=[]}b.prototype=new d.jqplot.GenericCanvas();b.prototype.constructor=b;d.jqplot.Dragable.parseOptions=function(i,h){var g=h||{};this.plugins.dragable=new d.jqplot.Dragable(g.dragable);this.isDragable=d.jqplot.config.enablePlugins};d.jqplot.Dragable.postPlotDraw=function(){if(this.plugins.dragable&&this.plugins.dragable.highlightCanvas){this.plugins.dragable.highlightCanvas.resetCanvas();this.plugins.dragable.highlightCanvas=null}this.plugins.dragable={previousCursor:"auto",isOver:false};this.plugins.dragable.dragCanvas=new b();this.eventCanvas._elem.before(this.plugins.dragable.dragCanvas.createElement(this._gridPadding,"jqplot-dragable-canvas",this._plotDimensions,this));var g=this.plugins.dragable.dragCanvas.setContext()};d.jqplot.preParseSeriesOptionsHooks.push(d.jqplot.Dragable.parseOptions);d.jqplot.postDrawHooks.push(d.jqplot.Dragable.postPlotDraw);d.jqplot.eventListenerHooks.push(["jqplotMouseMove",e]);d.jqplot.eventListenerHooks.push(["jqplotMouseDown",c]);d.jqplot.eventListenerHooks.push(["jqplotMouseUp",a]);function f(n,p){var q=n.series[p.seriesIndex];var m=q.plugins.dragable;var h=q.markerRenderer;var i=m.markerRenderer;i.style=h.style;i.lineWidth=h.lineWidth+2.5;i.size=h.size+5;if(!m.color){var l=d.jqplot.getColorComponents(h.color);var o=[l[0],l[1],l[2]];var k=(l[3]>=0.6)?l[3]*0.6:l[3]*(2-l[3]);m.color="rgba("+o[0]+","+o[1]+","+o[2]+","+k+")"}i.color=m.color;i.init();var g=(p.pointIndex>0)?p.pointIndex-1:0;var j=p.pointIndex+2;m._gridData=q.gridData.slice(g,j)}function e(o,l,h,t,m){if(m.plugins.dragable.dragCanvas.isDragging){var u=m.plugins.dragable.dragCanvas;var i=u._neighbor;var w=m.series[i.seriesIndex];var k=w.plugins.dragable;var r=w.gridData;var p=(k.constrainTo=="y")?i.gridData[0]:l.x;var n=(k.constrainTo=="x")?i.gridData[1]:l.y;var g=w._xaxis.series_p2u(p);var q=w._yaxis.series_p2u(n);var v=u._ctx;v.clearRect(0,0,v.canvas.width,v.canvas.height);if(i.pointIndex>0){k._gridData[1]=[p,n]}else{k._gridData[0]=[p,n]}m.series[i.seriesIndex].draw(u._ctx,{gridData:k._gridData,shadow:false,preventJqPlotSeriesDrawTrigger:true,color:k.color,markerOptions:{color:k.color,shadow:false},trendline:{show:false}});m.target.trigger("jqplotSeriesPointChange",[i.seriesIndex,i.pointIndex,[g,q],[p,n]])}else{if(t!=null){var j=m.series[t.seriesIndex];if(j.isDragable){var u=m.plugins.dragable.dragCanvas;if(!u.isOver){u._cursors.push(o.target.style.cursor);o.target.style.cursor="pointer"}u.isOver=true}}else{if(t==null){var u=m.plugins.dragable.dragCanvas;if(u.isOver){o.target.style.cursor=u._cursors.pop();u.isOver=false}}}}}function c(k,i,g,l,j){var m=j.plugins.dragable.dragCanvas;m._cursors.push(k.target.style.cursor);if(l!=null){var o=j.series[l.seriesIndex];var h=o.plugins.dragable;if(o.isDragable&&!m.isDragging){m._neighbor=l;m.isDragging=true;f(j,l);h.markerRenderer.draw(o.gridData[l.pointIndex][0],o.gridData[l.pointIndex][1],m._ctx);k.target.style.cursor="move";j.target.trigger("jqplotDragStart",[l.seriesIndex,l.pointIndex,i,g])}}else{var n=m._ctx;n.clearRect(0,0,n.canvas.width,n.canvas.height);m.isDragging=false}}function a(m,j,g,o,k){if(k.plugins.dragable.dragCanvas.isDragging){var p=k.plugins.dragable.dragCanvas;var q=p._ctx;q.clearRect(0,0,q.canvas.width,q.canvas.height);p.isDragging=false;var h=p._neighbor;var r=k.series[h.seriesIndex];var i=r.plugins.dragable;var n=(i.constrainTo=="y")?h.data[0]:g[r.xaxis];var l=(i.constrainTo=="x")?h.data[1]:g[r.yaxis];r.data[h.pointIndex][0]=n;r.data[h.pointIndex][1]=l;k.drawSeries({preventJqPlotSeriesDrawTrigger:true},h.seriesIndex);p._neighbor=null;m.target.style.cursor=p._cursors.pop();k.target.trigger("jqplotDragStop",[j,g])}}})(jQuery);
@@ -1,241 +1,241 @@
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.EnhancedLegendRenderer
32
- // Legend renderer which can specify the number of rows and/or columns in the legend.
33
- $.jqplot.EnhancedLegendRenderer = function(){
34
- $.jqplot.TableLegendRenderer.call(this);
35
- };
36
-
37
- $.jqplot.EnhancedLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
38
- $.jqplot.EnhancedLegendRenderer.prototype.constructor = $.jqplot.EnhancedLegendRenderer;
39
-
40
- // called with scope of legend.
41
- $.jqplot.EnhancedLegendRenderer.prototype.init = function(options) {
42
- // prop: numberRows
43
- // Maximum number of rows in the legend. 0 or null for unlimited.
44
- this.numberRows = null;
45
- // prop: numberColumns
46
- // Maximum number of columns in the legend. 0 or null for unlimited.
47
- this.numberColumns = null;
48
- // prop: seriesToggle
49
- // false to not enable series on/off toggling on the legend.
50
- // true or a fadein/fadeout speed (number of milliseconds or 'fast', 'normal', 'slow')
51
- // to enable show/hide of series on click of legend item.
52
- this.seriesToggle = 'normal';
53
- // prop: disableIEFading
54
- // true to toggle series with a show/hide method only and not allow fading in/out.
55
- // This is to overcome poor performance of fade in some versions of IE.
56
- this.disableIEFading = true;
57
- $.extend(true, this, options);
58
-
59
- if (this.seriesToggle) {
60
- $.jqplot.postDrawHooks.push(postDraw);
61
- }
62
- };
63
-
64
- // called with scope of legend
65
- $.jqplot.EnhancedLegendRenderer.prototype.draw = function() {
66
- var legend = this;
67
- if (this.show) {
68
- var series = this._series;
69
- var s;
70
- var ss = 'position:absolute;';
71
- ss += (this.background) ? 'background:'+this.background+';' : '';
72
- ss += (this.border) ? 'border:'+this.border+';' : '';
73
- ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
74
- ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
75
- ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
76
- ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
77
- ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
78
- ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
79
- ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
80
- this._elem = $('<table class="jqplot-table-legend" style="'+ss+'"></table>');
81
- if (this.seriesToggle) {
82
- this._elem.css('z-index', '3');
83
- }
84
-
85
- var pad = false,
86
- reverse = false,
87
- nr, nc;
88
- if (this.numberRows) {
89
- nr = this.numberRows;
90
- if (!this.numberColumns){
91
- nc = Math.ceil(series.length/nr);
92
- }
93
- else{
94
- nc = this.numberColumns;
95
- }
96
- }
97
- else if (this.numberColumns) {
98
- nc = this.numberColumns;
99
- nr = Math.ceil(series.length/this.numberColumns);
100
- }
101
- else {
102
- nr = series.length;
103
- nc = 1;
104
- }
105
-
106
- var i, j, tr, td1, td2, lt, rs, div, div0, div1;
107
- var idx = 0;
108
- // check to see if we need to reverse
109
- for (i=series.length-1; i>=0; i--) {
110
- if (nc == 1 && series[i]._stack || series[i].renderer.constructor == $.jqplot.BezierCurveRenderer){
111
- reverse = true;
112
- }
113
- }
114
-
115
- for (i=0; i<nr; i++) {
116
- tr = $(document.createElement('tr'));
117
- tr.addClass('jqplot-table-legend');
118
- if (reverse){
119
- tr.prependTo(this._elem);
120
- }
121
- else{
122
- tr.appendTo(this._elem);
123
- }
124
- for (j=0; j<nc; j++) {
125
- if (idx < series.length && series[idx].show && series[idx].showLabel){
126
- s = series[idx];
127
- lt = this.labels[idx] || s.label.toString();
128
- if (lt) {
129
- var color = s.color;
130
- if (!reverse){
131
- if (i>0){
132
- pad = true;
133
- }
134
- else{
135
- pad = false;
136
- }
137
- }
138
- else{
139
- if (i == nr -1){
140
- pad = false;
141
- }
142
- else{
143
- pad = true;
144
- }
145
- }
146
- rs = (pad) ? this.rowSpacing : '0';
147
-
148
- td1 = $(document.createElement('td'));
149
- td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
150
- td1.css({textAlign: 'center', paddingTop: rs});
151
-
152
- div0 = $(document.createElement('div'));
153
- div0.addClass('jqplot-table-legend-swatch-outline');
154
- div1 = $(document.createElement('div'));
155
- div1.addClass('jqplot-table-legend-swatch');
156
- div1.css({backgroundColor: color, borderColor: color});
157
-
158
- td1.append(div0.append(div1));
159
-
160
- td2 = $(document.createElement('td'));
161
- td2.addClass('jqplot-table-legend jqplot-table-legend-label');
162
- td2.css('paddingTop', rs);
163
-
164
- // td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+rs+';">'+
165
- // '<div><div class="jqplot-table-legend-swatch" style="background-color:'+color+';border-color:'+color+';"></div>'+
166
- // '</div></td>');
167
- // td2 = $('<td class="jqplot-table-legend" style="padding-top:'+rs+';"></td>');
168
- if (this.escapeHtml){
169
- td2.text(lt);
170
- }
171
- else {
172
- td2.html(lt);
173
- }
174
- if (reverse) {
175
- if (this.showLabels) {td2.prependTo(tr);}
176
- if (this.showSwatches) {td1.prependTo(tr);}
177
- }
178
- else {
179
- if (this.showSwatches) {td1.appendTo(tr);}
180
- if (this.showLabels) {td2.appendTo(tr);}
181
- }
182
-
183
- if (this.seriesToggle) {
184
-
185
- // add an overlay for clicking series on/off
186
- // div0 = $(document.createElement('div'));
187
- // div0.addClass('jqplot-table-legend-overlay');
188
- // div0.css({position:'relative', left:0, top:0, height:'100%', width:'100%'});
189
- // tr.append(div0);
190
-
191
- var speed;
192
- if (typeof(this.seriesToggle) == 'string' || typeof(this.seriesToggle) == 'number') {
193
- if (!$.jqplot.use_excanvas || !this.disableIEFading) {
194
- speed = this.seriesToggle;
195
- }
196
- }
197
- if (this.showSwatches) {
198
- td1.bind('click', {series:s, speed:speed}, handleToggle);
199
- td1.addClass('jqplot-seriesToggle');
200
- }
201
- if (this.showLabels) {
202
- td2.bind('click', {series:s, speed:speed}, handleToggle);
203
- td2.addClass('jqplot-seriesToggle');
204
- }
205
- }
206
-
207
- pad = true;
208
- }
209
- }
210
- idx++;
211
- }
212
-
213
- td1 = td2 = div0 = div1 = null;
214
- }
215
- }
216
- return this._elem;
217
- };
218
-
219
- var handleToggle = function (ev) {
220
- ev.data.series.toggleDisplay(ev);
221
- if (ev.data.series.canvas._elem.hasClass('jqplot-series-hidden')) {
222
- $(this).addClass('jqplot-series-hidden');
223
- $(this).next('.jqplot-table-legend-label').addClass('jqplot-series-hidden');
224
- $(this).prev('.jqplot-table-legend-swatch').addClass('jqplot-series-hidden');
225
-
226
- }
227
- else {
228
- $(this).removeClass('jqplot-series-hidden');
229
- $(this).next('.jqplot-table-legend-label').removeClass('jqplot-series-hidden');
230
- $(this).prev('.jqplot-table-legend-swatch').removeClass('jqplot-series-hidden');
231
- }
232
- };
233
-
234
- // called with scope of plot.
235
- var postDraw = function () {
236
- if (this.legend.renderer.constructor == $.jqplot.EnhancedLegendRenderer && this.legend.seriesToggle){
237
- var e = this.legend._elem.detach();
238
- this.eventCanvas._elem.after(e);
239
- }
240
- };
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.EnhancedLegendRenderer
32
+ // Legend renderer which can specify the number of rows and/or columns in the legend.
33
+ $.jqplot.EnhancedLegendRenderer = function(){
34
+ $.jqplot.TableLegendRenderer.call(this);
35
+ };
36
+
37
+ $.jqplot.EnhancedLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
38
+ $.jqplot.EnhancedLegendRenderer.prototype.constructor = $.jqplot.EnhancedLegendRenderer;
39
+
40
+ // called with scope of legend.
41
+ $.jqplot.EnhancedLegendRenderer.prototype.init = function(options) {
42
+ // prop: numberRows
43
+ // Maximum number of rows in the legend. 0 or null for unlimited.
44
+ this.numberRows = null;
45
+ // prop: numberColumns
46
+ // Maximum number of columns in the legend. 0 or null for unlimited.
47
+ this.numberColumns = null;
48
+ // prop: seriesToggle
49
+ // false to not enable series on/off toggling on the legend.
50
+ // true or a fadein/fadeout speed (number of milliseconds or 'fast', 'normal', 'slow')
51
+ // to enable show/hide of series on click of legend item.
52
+ this.seriesToggle = 'normal';
53
+ // prop: disableIEFading
54
+ // true to toggle series with a show/hide method only and not allow fading in/out.
55
+ // This is to overcome poor performance of fade in some versions of IE.
56
+ this.disableIEFading = true;
57
+ $.extend(true, this, options);
58
+
59
+ if (this.seriesToggle) {
60
+ $.jqplot.postDrawHooks.push(postDraw);
61
+ }
62
+ };
63
+
64
+ // called with scope of legend
65
+ $.jqplot.EnhancedLegendRenderer.prototype.draw = function() {
66
+ var legend = this;
67
+ if (this.show) {
68
+ var series = this._series;
69
+ var s;
70
+ var ss = 'position:absolute;';
71
+ ss += (this.background) ? 'background:'+this.background+';' : '';
72
+ ss += (this.border) ? 'border:'+this.border+';' : '';
73
+ ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
74
+ ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
75
+ ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
76
+ ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
77
+ ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
78
+ ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
79
+ ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
80
+ this._elem = $('<table class="jqplot-table-legend" style="'+ss+'"></table>');
81
+ if (this.seriesToggle) {
82
+ this._elem.css('z-index', '3');
83
+ }
84
+
85
+ var pad = false,
86
+ reverse = false,
87
+ nr, nc;
88
+ if (this.numberRows) {
89
+ nr = this.numberRows;
90
+ if (!this.numberColumns){
91
+ nc = Math.ceil(series.length/nr);
92
+ }
93
+ else{
94
+ nc = this.numberColumns;
95
+ }
96
+ }
97
+ else if (this.numberColumns) {
98
+ nc = this.numberColumns;
99
+ nr = Math.ceil(series.length/this.numberColumns);
100
+ }
101
+ else {
102
+ nr = series.length;
103
+ nc = 1;
104
+ }
105
+
106
+ var i, j, tr, td1, td2, lt, rs, div, div0, div1;
107
+ var idx = 0;
108
+ // check to see if we need to reverse
109
+ for (i=series.length-1; i>=0; i--) {
110
+ if (nc == 1 && series[i]._stack || series[i].renderer.constructor == $.jqplot.BezierCurveRenderer){
111
+ reverse = true;
112
+ }
113
+ }
114
+
115
+ for (i=0; i<nr; i++) {
116
+ tr = $(document.createElement('tr'));
117
+ tr.addClass('jqplot-table-legend');
118
+ if (reverse){
119
+ tr.prependTo(this._elem);
120
+ }
121
+ else{
122
+ tr.appendTo(this._elem);
123
+ }
124
+ for (j=0; j<nc; j++) {
125
+ if (idx < series.length && series[idx].show && series[idx].showLabel){
126
+ s = series[idx];
127
+ lt = this.labels[idx] || s.label.toString();
128
+ if (lt) {
129
+ var color = s.color;
130
+ if (!reverse){
131
+ if (i>0){
132
+ pad = true;
133
+ }
134
+ else{
135
+ pad = false;
136
+ }
137
+ }
138
+ else{
139
+ if (i == nr -1){
140
+ pad = false;
141
+ }
142
+ else{
143
+ pad = true;
144
+ }
145
+ }
146
+ rs = (pad) ? this.rowSpacing : '0';
147
+
148
+ td1 = $(document.createElement('td'));
149
+ td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
150
+ td1.css({textAlign: 'center', paddingTop: rs});
151
+
152
+ div0 = $(document.createElement('div'));
153
+ div0.addClass('jqplot-table-legend-swatch-outline');
154
+ div1 = $(document.createElement('div'));
155
+ div1.addClass('jqplot-table-legend-swatch');
156
+ div1.css({backgroundColor: color, borderColor: color});
157
+
158
+ td1.append(div0.append(div1));
159
+
160
+ td2 = $(document.createElement('td'));
161
+ td2.addClass('jqplot-table-legend jqplot-table-legend-label');
162
+ td2.css('paddingTop', rs);
163
+
164
+ // td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+rs+';">'+
165
+ // '<div><div class="jqplot-table-legend-swatch" style="background-color:'+color+';border-color:'+color+';"></div>'+
166
+ // '</div></td>');
167
+ // td2 = $('<td class="jqplot-table-legend" style="padding-top:'+rs+';"></td>');
168
+ if (this.escapeHtml){
169
+ td2.text(lt);
170
+ }
171
+ else {
172
+ td2.html(lt);
173
+ }
174
+ if (reverse) {
175
+ if (this.showLabels) {td2.prependTo(tr);}
176
+ if (this.showSwatches) {td1.prependTo(tr);}
177
+ }
178
+ else {
179
+ if (this.showSwatches) {td1.appendTo(tr);}
180
+ if (this.showLabels) {td2.appendTo(tr);}
181
+ }
182
+
183
+ if (this.seriesToggle) {
184
+
185
+ // add an overlay for clicking series on/off
186
+ // div0 = $(document.createElement('div'));
187
+ // div0.addClass('jqplot-table-legend-overlay');
188
+ // div0.css({position:'relative', left:0, top:0, height:'100%', width:'100%'});
189
+ // tr.append(div0);
190
+
191
+ var speed;
192
+ if (typeof(this.seriesToggle) == 'string' || typeof(this.seriesToggle) == 'number') {
193
+ if (!$.jqplot.use_excanvas || !this.disableIEFading) {
194
+ speed = this.seriesToggle;
195
+ }
196
+ }
197
+ if (this.showSwatches) {
198
+ td1.bind('click', {series:s, speed:speed}, handleToggle);
199
+ td1.addClass('jqplot-seriesToggle');
200
+ }
201
+ if (this.showLabels) {
202
+ td2.bind('click', {series:s, speed:speed}, handleToggle);
203
+ td2.addClass('jqplot-seriesToggle');
204
+ }
205
+ }
206
+
207
+ pad = true;
208
+ }
209
+ }
210
+ idx++;
211
+ }
212
+
213
+ td1 = td2 = div0 = div1 = null;
214
+ }
215
+ }
216
+ return this._elem;
217
+ };
218
+
219
+ var handleToggle = function (ev) {
220
+ ev.data.series.toggleDisplay(ev);
221
+ if (ev.data.series.canvas._elem.hasClass('jqplot-series-hidden')) {
222
+ $(this).addClass('jqplot-series-hidden');
223
+ $(this).next('.jqplot-table-legend-label').addClass('jqplot-series-hidden');
224
+ $(this).prev('.jqplot-table-legend-swatch').addClass('jqplot-series-hidden');
225
+
226
+ }
227
+ else {
228
+ $(this).removeClass('jqplot-series-hidden');
229
+ $(this).next('.jqplot-table-legend-label').removeClass('jqplot-series-hidden');
230
+ $(this).prev('.jqplot-table-legend-swatch').removeClass('jqplot-series-hidden');
231
+ }
232
+ };
233
+
234
+ // called with scope of plot.
235
+ var postDraw = function () {
236
+ if (this.legend.renderer.constructor == $.jqplot.EnhancedLegendRenderer && this.legend.seriesToggle){
237
+ var e = this.legend._elem.detach();
238
+ this.eventCanvas._elem.after(e);
239
+ }
240
+ };
241
241
  })(jQuery);