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.
- data/app/assets/javascripts/{jqueryCheats.js → jquery_cheats/jquery_cheats.js} +0 -0
- data/jquery_cheats.gemspec +1 -1
- data/lib/jquery_cheats/engine.rb +6 -0
- data/lib/{railtie.rb → jquery_cheats/railtie.rb} +0 -0
- data/lib/jquery_cheats.rb +2 -2
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/excanvas.js +1438 -1438
- data/vendor/assets/javascripts/jquery_cheats/jqplot/index.js +1 -0
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/jquery.jqplot.js +10901 -10901
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.BezierCurveRenderer.js +311 -311
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.BezierCurveRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.barRenderer.js +746 -746
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.barRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.blockRenderer.js +233 -233
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.blockRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.bubbleRenderer.js +753 -753
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.bubbleRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisLabelRenderer.js +201 -201
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisLabelRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisTickRenderer.js +241 -241
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisTickRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasOverlay.js +863 -863
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasOverlay.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasTextRenderer.js +447 -447
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasTextRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.categoryAxisRenderer.js +635 -635
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.categoryAxisRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ciParser.js +114 -114
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ciParser.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.cursor.js +1092 -1092
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.cursor.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dateAxisRenderer.js +702 -702
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dateAxisRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.donutRenderer.js +799 -799
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.donutRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dragable.js +223 -223
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dragable.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.enhancedLegendRenderer.js +240 -240
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.enhancedLegendRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.funnelRenderer.js +937 -937
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.funnelRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.highlighter.js +453 -453
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.highlighter.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.json2.js +475 -475
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.json2.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.logAxisRenderer.js +527 -527
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.logAxisRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoAxisRenderer.js +610 -610
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoAxisRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoRenderer.js +435 -435
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.meterGaugeRenderer.js +1028 -1028
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.meterGaugeRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ohlcRenderer.js +371 -371
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ohlcRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pieRenderer.js +898 -898
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pieRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pointLabels.js +361 -361
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pointLabels.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidAxisRenderer.js +729 -729
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidAxisRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidGridRenderer.js +422 -422
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidGridRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidRenderer.js +489 -489
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidRenderer.min.js +56 -56
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.trendline.js +221 -221
- data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.trendline.min.js +56 -56
- data/vendor/assets/stylesheets/{jquery.jqplot.css → jquery_cheats/jquery.jqplot.css} +259 -259
- metadata +68 -67
- data/lib/engine.rb +0 -7
data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.barRenderer.min.js
RENAMED
@@ -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.BarRenderer=function(){d.jqplot.LineRenderer.call(this)};d.jqplot.BarRenderer.prototype=new d.jqplot.LineRenderer();d.jqplot.BarRenderer.prototype.constructor=d.jqplot.BarRenderer;d.jqplot.BarRenderer.prototype.init=function(n,p){this.barPadding=8;this.barMargin=10;this.barDirection="vertical";this.barWidth=null;this.shadowOffset=2;this.shadowDepth=5;this.shadowAlpha=0.08;this.waterfall=false;this.groups=1;this.varyBarColor=false;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.transposedData=true;this.renderer.animation={show:false,direction:"down",speed:3000,_supported:true};this._type="bar";if(n.highlightMouseDown&&n.highlightMouseOver==null){n.highlightMouseOver=false}d.extend(true,this,n);d.extend(true,this.renderer,n);this.fill=true;if(this.barDirection==="horizontal"&&this.rendererOptions.animation&&this.rendererOptions.animation.direction==null){this.renderer.animation.direction="left"}if(this.waterfall){this.fillToZero=false;this.disableStack=true}if(this.barDirection=="vertical"){this._primaryAxis="_xaxis";this._stackAxis="y";this.fillAxis="y"}else{this._primaryAxis="_yaxis";this._stackAxis="x";this.fillAxis="x"}this._highlightedPoint=null;this._plotSeriesInfo=null;this._dataColors=[];this._barPoints=[];var o={lineJoin:"miter",lineCap:"round",fill:true,isarc:false,strokeStyle:this.color,fillStyle:this.color,closePath:this.fill};this.renderer.shapeRenderer.init(o);var m={lineJoin:"miter",lineCap:"round",fill:true,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,closePath:this.fill};this.renderer.shadowRenderer.init(m);p.postInitHooks.addOnce(h);p.postDrawHooks.addOnce(i);p.eventListenerHooks.addOnce("jqplotMouseMove",b);p.eventListenerHooks.addOnce("jqplotMouseDown",a);p.eventListenerHooks.addOnce("jqplotMouseUp",k);p.eventListenerHooks.addOnce("jqplotClick",e);p.eventListenerHooks.addOnce("jqplotRightClick",l)};function g(s,o,n,v){if(this.rendererOptions.barDirection=="horizontal"){this._stackAxis="x";this._primaryAxis="_yaxis"}if(this.rendererOptions.waterfall==true){this._data=d.extend(true,[],this.data);var r=0;var t=(!this.rendererOptions.barDirection||this.rendererOptions.barDirection==="vertical"||this.transposedData===false)?1:0;for(var p=0;p<this.data.length;p++){r+=this.data[p][t];if(p>0){this.data[p][t]+=this.data[p-1][t]}}this.data[this.data.length]=(t==1)?[this.data.length+1,r]:[r,this.data.length+1];this._data[this._data.length]=(t==1)?[this._data.length+1,r]:[r,this._data.length+1]}if(this.rendererOptions.groups>1){this.breakOnNull=true;var m=this.data.length;var u=parseInt(m/this.rendererOptions.groups,10);var q=0;for(var p=u;p<m;p+=u){this.data.splice(p+q,0,[null,null]);q++}for(p=0;p<this.data.length;p++){if(this._primaryAxis=="_xaxis"){this.data[p][0]=p+1}else{this.data[p][1]=p+1}}}}d.jqplot.preSeriesInitHooks.push(g);d.jqplot.BarRenderer.prototype.calcSeriesNumbers=function(){var q=0;var r=0;var p=this[this._primaryAxis];var o,n,t;for(var m=0;m<p._series.length;m++){n=p._series[m];if(n===this){t=m}if(n.renderer.constructor==d.jqplot.BarRenderer){q+=n.data.length;r+=1}}return[q,r,t]};d.jqplot.BarRenderer.prototype.setBarWidth=function(){var p;var m=0;var n=0;var r=this[this._primaryAxis];var w,q,u;var v=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);m=v[0];n=v[1];var t=r.numberTicks;var o=(t-1)/2;if(r.name=="xaxis"||r.name=="x2axis"){if(this._stack){this.barWidth=(r._offsets.max-r._offsets.min)/m*n-this.barMargin}else{this.barWidth=((r._offsets.max-r._offsets.min)/o-this.barPadding*(n-1)-this.barMargin*2)/n}}else{if(this._stack){this.barWidth=(r._offsets.min-r._offsets.max)/m*n-this.barMargin}else{this.barWidth=((r._offsets.min-r._offsets.max)/o-this.barPadding*(n-1)-this.barMargin*2)/n}}return[m,n]};function f(n){var p=[];for(var r=0;r<n.length;r++){var q=d.jqplot.getColorComponents(n[r]);var m=[q[0],q[1],q[2]];var s=m[0]+m[1]+m[2];for(var o=0;o<3;o++){m[o]=(s>570)?m[o]*0.8:m[o]+0.3*(255-m[o]);m[o]=parseInt(m[o],10)}p.push("rgb("+m[0]+","+m[1]+","+m[2]+")")}return p}d.jqplot.BarRenderer.prototype.draw=function(D,J,p){var G;var z=d.extend({},p);var u=(z.shadow!=undefined)?z.shadow:this.shadow;var M=(z.showLine!=undefined)?z.showLine:this.showLine;var E=(z.fill!=undefined)?z.fill:this.fill;var o=this.xaxis;var H=this.yaxis;var x=this._xaxis.series_u2p;var I=this._yaxis.series_u2p;var C,B;this._dataColors=[];this._barPoints=[];if(this.barWidth==null){this.renderer.setBarWidth.call(this)}var L=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);var w=L[0];var v=L[1];var r=L[2];var F=[];if(this._stack){this._barNudge=0}else{this._barNudge=(-Math.abs(v/2-0.5)+r)*(this.barWidth+this.barPadding)}if(M){var t=new d.jqplot.ColorGenerator(this.negativeSeriesColors);var A=new d.jqplot.ColorGenerator(this.seriesColors);var K=t.get(this.index);if(!this.useNegativeColors){K=z.fillStyle}var s=z.fillStyle;var q;var N;var n;if(this.barDirection=="vertical"){for(var G=0;G<J.length;G++){if(this.data[G][1]==null){continue}F=[];q=J[G][0]+this._barNudge;n;if(this._stack&&this._prevGridData.length){n=this._prevGridData[G][1]}else{if(this.fillToZero){n=this._yaxis.series_u2p(0)}else{if(this.waterfall&&G>0&&G<this.gridData.length-1){n=this.gridData[G-1][1]}else{if(this.waterfall&&G==0&&G<this.gridData.length-1){if(this._yaxis.min<=0&&this._yaxis.max>=0){n=this._yaxis.series_u2p(0)}else{if(this._yaxis.min>0){n=D.canvas.height}else{n=0}}}else{if(this.waterfall&&G==this.gridData.length-1){if(this._yaxis.min<=0&&this._yaxis.max>=0){n=this._yaxis.series_u2p(0)}else{if(this._yaxis.min>0){n=D.canvas.height}else{n=0}}}else{n=D.canvas.height}}}}}if((this.fillToZero&&this._plotData[G][1]<0)||(this.waterfall&&this._data[G][1]<0)){if(this.varyBarColor&&!this._stack){if(this.useNegativeColors){z.fillStyle=t.next()}else{z.fillStyle=A.next()}}else{z.fillStyle=K}}else{if(this.varyBarColor&&!this._stack){z.fillStyle=A.next()}else{z.fillStyle=s}}if(!this.fillToZero||this._plotData[G][1]>=0){F.push([q-this.barWidth/2,n]);F.push([q-this.barWidth/2,J[G][1]]);F.push([q+this.barWidth/2,J[G][1]]);F.push([q+this.barWidth/2,n])}else{F.push([q-this.barWidth/2,J[G][1]]);F.push([q-this.barWidth/2,n]);F.push([q+this.barWidth/2,n]);F.push([q+this.barWidth/2,J[G][1]])}this._barPoints.push(F);if(u&&!this._stack){var y=d.extend(true,{},z);delete y.fillStyle;this.renderer.shadowRenderer.draw(D,F,y)}var m=z.fillStyle||this.color;this._dataColors.push(m);this.renderer.shapeRenderer.draw(D,F,z)}}else{if(this.barDirection=="horizontal"){for(var G=0;G<J.length;G++){if(this.data[G][0]==null){continue}F=[];q=J[G][1]-this._barNudge;N;if(this._stack&&this._prevGridData.length){N=this._prevGridData[G][0]}else{if(this.fillToZero){N=this._xaxis.series_u2p(0)}else{if(this.waterfall&&G>0&&G<this.gridData.length-1){N=this.gridData[G-1][1]}else{if(this.waterfall&&G==0&&G<this.gridData.length-1){if(this._xaxis.min<=0&&this._xaxis.max>=0){N=this._xaxis.series_u2p(0)}else{if(this._xaxis.min>0){N=0}else{N=D.canvas.width}}}else{if(this.waterfall&&G==this.gridData.length-1){if(this._xaxis.min<=0&&this._xaxis.max>=0){N=this._xaxis.series_u2p(0)}else{if(this._xaxis.min>0){N=0}else{N=D.canvas.width}}}else{N=0}}}}}if((this.fillToZero&&this._plotData[G][1]<0)||(this.waterfall&&this._data[G][1]<0)){if(this.varyBarColor&&!this._stack){if(this.useNegativeColors){z.fillStyle=t.next()}else{z.fillStyle=A.next()}}}else{if(this.varyBarColor&&!this._stack){z.fillStyle=A.next()}else{z.fillStyle=s}}if(!this.fillToZero||this._plotData[G][0]>=0){F.push([N,q+this.barWidth/2]);F.push([N,q-this.barWidth/2]);F.push([J[G][0],q-this.barWidth/2]);F.push([J[G][0],q+this.barWidth/2])}else{F.push([J[G][0],q+this.barWidth/2]);F.push([J[G][0],q-this.barWidth/2]);F.push([N,q-this.barWidth/2]);F.push([N,q+this.barWidth/2])}this._barPoints.push(F);if(u&&!this._stack){var y=d.extend(true,{},z);delete y.fillStyle;this.renderer.shadowRenderer.draw(D,F,y)}var m=z.fillStyle||this.color;this._dataColors.push(m);this.renderer.shapeRenderer.draw(D,F,z)}}}}if(this.highlightColors.length==0){this.highlightColors=d.jqplot.computeHighlightColors(this._dataColors)}else{if(typeof(this.highlightColors)=="string"){var L=this.highlightColors;this.highlightColors=[];for(var G=0;G<this._dataColors.length;G++){this.highlightColors.push(L)}}}};d.jqplot.BarRenderer.prototype.drawShadow=function(y,E,o){var B;var v=(o!=undefined)?o:{};var r=(v.shadow!=undefined)?v.shadow:this.shadow;var G=(v.showLine!=undefined)?v.showLine:this.showLine;var z=(v.fill!=undefined)?v.fill:this.fill;var n=this.xaxis;var C=this.yaxis;var u=this._xaxis.series_u2p;var D=this._yaxis.series_u2p;var x,A,w,t,s,q;if(this._stack&&this.shadow){if(this.barWidth==null){this.renderer.setBarWidth.call(this)}var F=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);t=F[0];s=F[1];q=F[2];if(this._stack){this._barNudge=0}else{this._barNudge=(-Math.abs(s/2-0.5)+q)*(this.barWidth+this.barPadding)}if(G){if(this.barDirection=="vertical"){for(var B=0;B<E.length;B++){if(this.data[B][1]==null){continue}A=[];var p=E[B][0]+this._barNudge;var m;if(this._stack&&this._prevGridData.length){m=this._prevGridData[B][1]}else{if(this.fillToZero){m=this._yaxis.series_u2p(0)}else{m=y.canvas.height}}A.push([p-this.barWidth/2,m]);A.push([p-this.barWidth/2,E[B][1]]);A.push([p+this.barWidth/2,E[B][1]]);A.push([p+this.barWidth/2,m]);this.renderer.shadowRenderer.draw(y,A,v)}}else{if(this.barDirection=="horizontal"){for(var B=0;B<E.length;B++){if(this.data[B][0]==null){continue}A=[];var p=E[B][1]-this._barNudge;var H;if(this._stack&&this._prevGridData.length){H=this._prevGridData[B][0]}else{H=0}A.push([H,p+this.barWidth/2]);A.push([E[B][0],p+this.barWidth/2]);A.push([E[B][0],p-this.barWidth/2]);A.push([H,p-this.barWidth/2]);this.renderer.shadowRenderer.draw(y,A,v)}}}}}};function h(p,o,m){for(var n=0;n<this.series.length;n++){if(this.series[n].renderer.constructor==d.jqplot.BarRenderer){if(this.series[n].highlightMouseOver){this.series[n].highlightMouseDown=false}}}}function i(){if(this.plugins.barRenderer&&this.plugins.barRenderer.highlightCanvas){this.plugins.barRenderer.highlightCanvas.resetCanvas();this.plugins.barRenderer.highlightCanvas=null}this.plugins.barRenderer={highlightedSeriesIndex:null};this.plugins.barRenderer.highlightCanvas=new d.jqplot.GenericCanvas();this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-barRenderer-highlight-canvas",this._plotDimensions,this));this.plugins.barRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(m){j(m.data.plot)})}function c(t,r,p,o){var n=t.series[r];var m=t.plugins.barRenderer.highlightCanvas;m._ctx.clearRect(0,0,m._ctx.canvas.width,m._ctx.canvas.height);n._highlightedPoint=p;t.plugins.barRenderer.highlightedSeriesIndex=r;var q={fillStyle:n.highlightColors[p]};n.renderer.shapeRenderer.draw(m._ctx,o,q);m=null}function j(o){var m=o.plugins.barRenderer.highlightCanvas;m._ctx.clearRect(0,0,m._ctx.canvas.width,m._ctx.canvas.height);for(var n=0;n<o.series.length;n++){o.series[n]._highlightedPoint=null}o.plugins.barRenderer.highlightedSeriesIndex=null;o.target.trigger("jqplotDataUnhighlight");m=null}function b(q,p,t,s,r){if(s){var o=[s.seriesIndex,s.pointIndex,s.data];var n=jQuery.Event("jqplotDataMouseOver");n.pageX=q.pageX;n.pageY=q.pageY;r.target.trigger(n,o);if(r.series[o[0]].highlightMouseOver&&!(o[0]==r.plugins.barRenderer.highlightedSeriesIndex&&o[1]==r.series[o[0]]._highlightedPoint)){var m=jQuery.Event("jqplotDataHighlight");m.pageX=q.pageX;m.pageY=q.pageY;r.target.trigger(m,o);c(r,s.seriesIndex,s.pointIndex,s.points)}}else{if(s==null){j(r)}}}function a(p,o,s,r,q){if(r){var n=[r.seriesIndex,r.pointIndex,r.data];if(q.series[n[0]].highlightMouseDown&&!(n[0]==q.plugins.barRenderer.highlightedSeriesIndex&&n[1]==q.series[n[0]]._highlightedPoint)){var m=jQuery.Event("jqplotDataHighlight");m.pageX=p.pageX;m.pageY=p.pageY;q.target.trigger(m,n);c(q,r.seriesIndex,r.pointIndex,r.points)}}else{if(r==null){j(q)}}}function k(o,n,r,q,p){var m=p.plugins.barRenderer.highlightedSeriesIndex;if(m!=null&&p.series[m].highlightMouseDown){j(p)}}function e(p,o,s,r,q){if(r){var n=[r.seriesIndex,r.pointIndex,r.data];var m=jQuery.Event("jqplotDataClick");m.pageX=p.pageX;m.pageY=p.pageY;q.target.trigger(m,n)}}function l(q,p,t,s,r){if(s){var o=[s.seriesIndex,s.pointIndex,s.data];var m=r.plugins.barRenderer.highlightedSeriesIndex;if(m!=null&&r.series[m].highlightMouseDown){j(r)}var n=jQuery.Event("jqplotDataRightClick");n.pageX=q.pageX;n.pageY=q.pageY;r.target.trigger(n,o)}}})(jQuery);
|
data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.blockRenderer.js
RENAMED
@@ -1,234 +1,234 @@
|
|
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
|
-
/**
|
32
|
-
* Class: $.jqplot.BlockRenderer
|
33
|
-
* Plugin renderer to draw a x-y block chart. A Block chart has data points displayed as
|
34
|
-
* colored squares with a text label inside. Data must be supplied in the form:
|
35
|
-
*
|
36
|
-
* > [[x1, y1, "label 1", {css}], [x2, y2, "label 2", {css}], ...]
|
37
|
-
*
|
38
|
-
* The label and css object are optional. If the label is ommitted, the
|
39
|
-
* box will collapse unless a css height and/or width is specified.
|
40
|
-
*
|
41
|
-
* The css object is an object specifying css properties
|
42
|
-
* such as:
|
43
|
-
*
|
44
|
-
* > {background:'#4f98a5', border:'3px solid gray', padding:'1px'}
|
45
|
-
*
|
46
|
-
* Note that css properties specified with the data point override defaults
|
47
|
-
* specified with the series.
|
48
|
-
*
|
49
|
-
*/
|
50
|
-
$.jqplot.BlockRenderer = function(){
|
51
|
-
$.jqplot.LineRenderer.call(this);
|
52
|
-
};
|
53
|
-
|
54
|
-
$.jqplot.BlockRenderer.prototype = new $.jqplot.LineRenderer();
|
55
|
-
$.jqplot.BlockRenderer.prototype.constructor = $.jqplot.BlockRenderer;
|
56
|
-
|
57
|
-
// called with scope of a series
|
58
|
-
$.jqplot.BlockRenderer.prototype.init = function(options) {
|
59
|
-
// Group: Properties
|
60
|
-
//
|
61
|
-
// prop: css
|
62
|
-
// default css styles that will be applied to all data blocks.
|
63
|
-
// these values will be overridden by css styles supplied with the
|
64
|
-
// individulal data points.
|
65
|
-
this.css = {padding:'2px', border:'1px solid #999', textAlign:'center'};
|
66
|
-
// prop: escapeHtml
|
67
|
-
// true to escape html in the box label.
|
68
|
-
this.escapeHtml = false;
|
69
|
-
// prop: insertBreaks
|
70
|
-
// true to turn spaces in data block label into html breaks <br />.
|
71
|
-
this.insertBreaks = true;
|
72
|
-
// prop: varyBlockColors
|
73
|
-
// true to vary the color of each block in this series according to
|
74
|
-
// the seriesColors array. False to set each block to the color
|
75
|
-
// specified on this series. This has no effect if a css background color
|
76
|
-
// option is specified in the renderer css options.
|
77
|
-
this.varyBlockColors = false;
|
78
|
-
$.extend(true, this, options);
|
79
|
-
if (this.css.backgroundColor) {
|
80
|
-
this.color = this.css.backgroundColor;
|
81
|
-
}
|
82
|
-
else if (this.css.background) {
|
83
|
-
this.color = this.css.background;
|
84
|
-
}
|
85
|
-
else if (!this.varyBlockColors) {
|
86
|
-
this.css.background = this.color;
|
87
|
-
}
|
88
|
-
this.canvas = new $.jqplot.BlockCanvas();
|
89
|
-
this.shadowCanvas = new $.jqplot.BlockCanvas();
|
90
|
-
this.canvas._plotDimensions = this._plotDimensions;
|
91
|
-
this.shadowCanvas._plotDimensions = this._plotDimensions;
|
92
|
-
this._type = 'block';
|
93
|
-
|
94
|
-
// group: Methods
|
95
|
-
//
|
96
|
-
// Method: moveBlock
|
97
|
-
// Moves an individual block. More efficient than redrawing
|
98
|
-
// the whole series by calling plot.drawSeries().
|
99
|
-
// Properties:
|
100
|
-
// idx - the 0 based index of the block or point in this series.
|
101
|
-
// x - the x coordinate in data units (value on x axis) to move the block to.
|
102
|
-
// y - the y coordinate in data units (value on the y axis) to move the block to.
|
103
|
-
// duration - optional parameter to create an animated movement. Can be a
|
104
|
-
// number (higher is slower animation) or 'fast', 'normal' or 'slow'. If not
|
105
|
-
// provided, the element is moved without any animation.
|
106
|
-
this.moveBlock = function (idx, x, y, duration) {
|
107
|
-
// update plotData, stackData, data and gridData
|
108
|
-
// x and y are in data coordinates.
|
109
|
-
var el = this.canvas._elem.children(':eq('+idx+')');
|
110
|
-
this.data[idx][0] = x;
|
111
|
-
this.data[idx][1] = y;
|
112
|
-
this._plotData[idx][0] = x;
|
113
|
-
this._plotData[idx][1] = y;
|
114
|
-
this._stackData[idx][0] = x;
|
115
|
-
this._stackData[idx][1] = y;
|
116
|
-
this.gridData[idx][0] = this._xaxis.series_u2p(x);
|
117
|
-
this.gridData[idx][1] = this._yaxis.series_u2p(y);
|
118
|
-
var w = el.outerWidth();
|
119
|
-
var h = el.outerHeight();
|
120
|
-
var left = this.gridData[idx][0] - w/2 + 'px';
|
121
|
-
var top = this.gridData[idx][1] - h/2 + 'px';
|
122
|
-
if (duration) {
|
123
|
-
if (parseInt(duration, 10)) {
|
124
|
-
duration = parseInt(duration, 10);
|
125
|
-
}
|
126
|
-
el.animate({left:left, top:top}, duration);
|
127
|
-
}
|
128
|
-
else {
|
129
|
-
el.css({left:left, top:top});
|
130
|
-
}
|
131
|
-
el = null;
|
132
|
-
};
|
133
|
-
};
|
134
|
-
|
135
|
-
// called with scope of series
|
136
|
-
$.jqplot.BlockRenderer.prototype.draw = function (ctx, gd, options) {
|
137
|
-
if (this.plugins.pointLabels) {
|
138
|
-
this.plugins.pointLabels.show = false;
|
139
|
-
}
|
140
|
-
var i, el, d, gd, t, css, w, h, left, top;
|
141
|
-
var opts = (options != undefined) ? options : {};
|
142
|
-
var colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
|
143
|
-
this.canvas._elem.empty();
|
144
|
-
for (i=0; i<this.gridData.length; i++) {
|
145
|
-
d = this.data[i];
|
146
|
-
gd = this.gridData[i];
|
147
|
-
t = '';
|
148
|
-
css = {};
|
149
|
-
if (typeof d[2] == 'string') {
|
150
|
-
t = d[2];
|
151
|
-
}
|
152
|
-
else if (typeof d[2] == 'object') {
|
153
|
-
css = d[2];
|
154
|
-
}
|
155
|
-
if (typeof d[3] == 'object') {
|
156
|
-
css = d[3];
|
157
|
-
}
|
158
|
-
if (this.insertBreaks){
|
159
|
-
t = t.replace(/ /g, '<br />');
|
160
|
-
}
|
161
|
-
css = $.extend(true, {}, this.css, css);
|
162
|
-
// create a div
|
163
|
-
el = $('<div style="position:absolute;margin-left:auto;margin-right:auto;"></div>');
|
164
|
-
this.canvas._elem.append(el);
|
165
|
-
// set text
|
166
|
-
this.escapeHtml ? el.text(t) : el.html(t);
|
167
|
-
// style it
|
168
|
-
// remove styles we don't want overridden.
|
169
|
-
delete css.position;
|
170
|
-
delete css.marginRight;
|
171
|
-
delete css.marginLeft;
|
172
|
-
if (!css.background && !css.backgroundColor && !css.backgroundImage){
|
173
|
-
css.background = colorGenerator.next();
|
174
|
-
}
|
175
|
-
el.css(css);
|
176
|
-
w = el.outerWidth();
|
177
|
-
h = el.outerHeight();
|
178
|
-
left = gd[0] - w/2 + 'px';
|
179
|
-
top = gd[1] - h/2 + 'px';
|
180
|
-
el.css({left:left, top:top});
|
181
|
-
el = null;
|
182
|
-
}
|
183
|
-
};
|
184
|
-
|
185
|
-
$.jqplot.BlockCanvas = function() {
|
186
|
-
$.jqplot.ElemContainer.call(this);
|
187
|
-
this._ctx;
|
188
|
-
};
|
189
|
-
|
190
|
-
$.jqplot.BlockCanvas.prototype = new $.jqplot.ElemContainer();
|
191
|
-
$.jqplot.BlockCanvas.prototype.constructor = $.jqplot.BlockCanvas;
|
192
|
-
|
193
|
-
$.jqplot.BlockCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
|
194
|
-
this._offsets = offsets;
|
195
|
-
var klass = 'jqplot-blockCanvas';
|
196
|
-
if (clss != undefined) {
|
197
|
-
klass = clss;
|
198
|
-
}
|
199
|
-
var elem;
|
200
|
-
// if this canvas already has a dom element, don't make a new one.
|
201
|
-
if (this._elem) {
|
202
|
-
elem = this._elem.get(0);
|
203
|
-
}
|
204
|
-
else {
|
205
|
-
elem = document.createElement('div');
|
206
|
-
}
|
207
|
-
// if new plotDimensions supplied, use them.
|
208
|
-
if (plotDimensions != undefined) {
|
209
|
-
this._plotDimensions = plotDimensions;
|
210
|
-
}
|
211
|
-
|
212
|
-
var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
|
213
|
-
var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
|
214
|
-
this._elem = $(elem);
|
215
|
-
this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
|
216
|
-
|
217
|
-
this._elem.addClass(klass);
|
218
|
-
return this._elem;
|
219
|
-
};
|
220
|
-
|
221
|
-
$.jqplot.BlockCanvas.prototype.setContext = function() {
|
222
|
-
this._ctx = {
|
223
|
-
canvas:{
|
224
|
-
width:0,
|
225
|
-
height:0
|
226
|
-
},
|
227
|
-
clearRect:function(){return null;}
|
228
|
-
};
|
229
|
-
return this._ctx;
|
230
|
-
};
|
231
|
-
|
232
|
-
})(jQuery);
|
233
|
-
|
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
|
+
/**
|
32
|
+
* Class: $.jqplot.BlockRenderer
|
33
|
+
* Plugin renderer to draw a x-y block chart. A Block chart has data points displayed as
|
34
|
+
* colored squares with a text label inside. Data must be supplied in the form:
|
35
|
+
*
|
36
|
+
* > [[x1, y1, "label 1", {css}], [x2, y2, "label 2", {css}], ...]
|
37
|
+
*
|
38
|
+
* The label and css object are optional. If the label is ommitted, the
|
39
|
+
* box will collapse unless a css height and/or width is specified.
|
40
|
+
*
|
41
|
+
* The css object is an object specifying css properties
|
42
|
+
* such as:
|
43
|
+
*
|
44
|
+
* > {background:'#4f98a5', border:'3px solid gray', padding:'1px'}
|
45
|
+
*
|
46
|
+
* Note that css properties specified with the data point override defaults
|
47
|
+
* specified with the series.
|
48
|
+
*
|
49
|
+
*/
|
50
|
+
$.jqplot.BlockRenderer = function(){
|
51
|
+
$.jqplot.LineRenderer.call(this);
|
52
|
+
};
|
53
|
+
|
54
|
+
$.jqplot.BlockRenderer.prototype = new $.jqplot.LineRenderer();
|
55
|
+
$.jqplot.BlockRenderer.prototype.constructor = $.jqplot.BlockRenderer;
|
56
|
+
|
57
|
+
// called with scope of a series
|
58
|
+
$.jqplot.BlockRenderer.prototype.init = function(options) {
|
59
|
+
// Group: Properties
|
60
|
+
//
|
61
|
+
// prop: css
|
62
|
+
// default css styles that will be applied to all data blocks.
|
63
|
+
// these values will be overridden by css styles supplied with the
|
64
|
+
// individulal data points.
|
65
|
+
this.css = {padding:'2px', border:'1px solid #999', textAlign:'center'};
|
66
|
+
// prop: escapeHtml
|
67
|
+
// true to escape html in the box label.
|
68
|
+
this.escapeHtml = false;
|
69
|
+
// prop: insertBreaks
|
70
|
+
// true to turn spaces in data block label into html breaks <br />.
|
71
|
+
this.insertBreaks = true;
|
72
|
+
// prop: varyBlockColors
|
73
|
+
// true to vary the color of each block in this series according to
|
74
|
+
// the seriesColors array. False to set each block to the color
|
75
|
+
// specified on this series. This has no effect if a css background color
|
76
|
+
// option is specified in the renderer css options.
|
77
|
+
this.varyBlockColors = false;
|
78
|
+
$.extend(true, this, options);
|
79
|
+
if (this.css.backgroundColor) {
|
80
|
+
this.color = this.css.backgroundColor;
|
81
|
+
}
|
82
|
+
else if (this.css.background) {
|
83
|
+
this.color = this.css.background;
|
84
|
+
}
|
85
|
+
else if (!this.varyBlockColors) {
|
86
|
+
this.css.background = this.color;
|
87
|
+
}
|
88
|
+
this.canvas = new $.jqplot.BlockCanvas();
|
89
|
+
this.shadowCanvas = new $.jqplot.BlockCanvas();
|
90
|
+
this.canvas._plotDimensions = this._plotDimensions;
|
91
|
+
this.shadowCanvas._plotDimensions = this._plotDimensions;
|
92
|
+
this._type = 'block';
|
93
|
+
|
94
|
+
// group: Methods
|
95
|
+
//
|
96
|
+
// Method: moveBlock
|
97
|
+
// Moves an individual block. More efficient than redrawing
|
98
|
+
// the whole series by calling plot.drawSeries().
|
99
|
+
// Properties:
|
100
|
+
// idx - the 0 based index of the block or point in this series.
|
101
|
+
// x - the x coordinate in data units (value on x axis) to move the block to.
|
102
|
+
// y - the y coordinate in data units (value on the y axis) to move the block to.
|
103
|
+
// duration - optional parameter to create an animated movement. Can be a
|
104
|
+
// number (higher is slower animation) or 'fast', 'normal' or 'slow'. If not
|
105
|
+
// provided, the element is moved without any animation.
|
106
|
+
this.moveBlock = function (idx, x, y, duration) {
|
107
|
+
// update plotData, stackData, data and gridData
|
108
|
+
// x and y are in data coordinates.
|
109
|
+
var el = this.canvas._elem.children(':eq('+idx+')');
|
110
|
+
this.data[idx][0] = x;
|
111
|
+
this.data[idx][1] = y;
|
112
|
+
this._plotData[idx][0] = x;
|
113
|
+
this._plotData[idx][1] = y;
|
114
|
+
this._stackData[idx][0] = x;
|
115
|
+
this._stackData[idx][1] = y;
|
116
|
+
this.gridData[idx][0] = this._xaxis.series_u2p(x);
|
117
|
+
this.gridData[idx][1] = this._yaxis.series_u2p(y);
|
118
|
+
var w = el.outerWidth();
|
119
|
+
var h = el.outerHeight();
|
120
|
+
var left = this.gridData[idx][0] - w/2 + 'px';
|
121
|
+
var top = this.gridData[idx][1] - h/2 + 'px';
|
122
|
+
if (duration) {
|
123
|
+
if (parseInt(duration, 10)) {
|
124
|
+
duration = parseInt(duration, 10);
|
125
|
+
}
|
126
|
+
el.animate({left:left, top:top}, duration);
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
el.css({left:left, top:top});
|
130
|
+
}
|
131
|
+
el = null;
|
132
|
+
};
|
133
|
+
};
|
134
|
+
|
135
|
+
// called with scope of series
|
136
|
+
$.jqplot.BlockRenderer.prototype.draw = function (ctx, gd, options) {
|
137
|
+
if (this.plugins.pointLabels) {
|
138
|
+
this.plugins.pointLabels.show = false;
|
139
|
+
}
|
140
|
+
var i, el, d, gd, t, css, w, h, left, top;
|
141
|
+
var opts = (options != undefined) ? options : {};
|
142
|
+
var colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
|
143
|
+
this.canvas._elem.empty();
|
144
|
+
for (i=0; i<this.gridData.length; i++) {
|
145
|
+
d = this.data[i];
|
146
|
+
gd = this.gridData[i];
|
147
|
+
t = '';
|
148
|
+
css = {};
|
149
|
+
if (typeof d[2] == 'string') {
|
150
|
+
t = d[2];
|
151
|
+
}
|
152
|
+
else if (typeof d[2] == 'object') {
|
153
|
+
css = d[2];
|
154
|
+
}
|
155
|
+
if (typeof d[3] == 'object') {
|
156
|
+
css = d[3];
|
157
|
+
}
|
158
|
+
if (this.insertBreaks){
|
159
|
+
t = t.replace(/ /g, '<br />');
|
160
|
+
}
|
161
|
+
css = $.extend(true, {}, this.css, css);
|
162
|
+
// create a div
|
163
|
+
el = $('<div style="position:absolute;margin-left:auto;margin-right:auto;"></div>');
|
164
|
+
this.canvas._elem.append(el);
|
165
|
+
// set text
|
166
|
+
this.escapeHtml ? el.text(t) : el.html(t);
|
167
|
+
// style it
|
168
|
+
// remove styles we don't want overridden.
|
169
|
+
delete css.position;
|
170
|
+
delete css.marginRight;
|
171
|
+
delete css.marginLeft;
|
172
|
+
if (!css.background && !css.backgroundColor && !css.backgroundImage){
|
173
|
+
css.background = colorGenerator.next();
|
174
|
+
}
|
175
|
+
el.css(css);
|
176
|
+
w = el.outerWidth();
|
177
|
+
h = el.outerHeight();
|
178
|
+
left = gd[0] - w/2 + 'px';
|
179
|
+
top = gd[1] - h/2 + 'px';
|
180
|
+
el.css({left:left, top:top});
|
181
|
+
el = null;
|
182
|
+
}
|
183
|
+
};
|
184
|
+
|
185
|
+
$.jqplot.BlockCanvas = function() {
|
186
|
+
$.jqplot.ElemContainer.call(this);
|
187
|
+
this._ctx;
|
188
|
+
};
|
189
|
+
|
190
|
+
$.jqplot.BlockCanvas.prototype = new $.jqplot.ElemContainer();
|
191
|
+
$.jqplot.BlockCanvas.prototype.constructor = $.jqplot.BlockCanvas;
|
192
|
+
|
193
|
+
$.jqplot.BlockCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
|
194
|
+
this._offsets = offsets;
|
195
|
+
var klass = 'jqplot-blockCanvas';
|
196
|
+
if (clss != undefined) {
|
197
|
+
klass = clss;
|
198
|
+
}
|
199
|
+
var elem;
|
200
|
+
// if this canvas already has a dom element, don't make a new one.
|
201
|
+
if (this._elem) {
|
202
|
+
elem = this._elem.get(0);
|
203
|
+
}
|
204
|
+
else {
|
205
|
+
elem = document.createElement('div');
|
206
|
+
}
|
207
|
+
// if new plotDimensions supplied, use them.
|
208
|
+
if (plotDimensions != undefined) {
|
209
|
+
this._plotDimensions = plotDimensions;
|
210
|
+
}
|
211
|
+
|
212
|
+
var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
|
213
|
+
var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
|
214
|
+
this._elem = $(elem);
|
215
|
+
this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
|
216
|
+
|
217
|
+
this._elem.addClass(klass);
|
218
|
+
return this._elem;
|
219
|
+
};
|
220
|
+
|
221
|
+
$.jqplot.BlockCanvas.prototype.setContext = function() {
|
222
|
+
this._ctx = {
|
223
|
+
canvas:{
|
224
|
+
width:0,
|
225
|
+
height:0
|
226
|
+
},
|
227
|
+
clearRect:function(){return null;}
|
228
|
+
};
|
229
|
+
return this._ctx;
|
230
|
+
};
|
231
|
+
|
232
|
+
})(jQuery);
|
233
|
+
|
234
234
|
|