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.pyramidRenderer.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(c){if(c.jqplot.PyramidAxisRenderer===undefined){c.ajax({url:c.jqplot.pluginLocation+"jqplot.pyramidAxisRenderer.js",dataType:"script",async:false})}if(c.jqplot.PyramidGridRenderer===undefined){c.ajax({url:c.jqplot.pluginLocation+"jqplot.pyramidGridRenderer.js",dataType:"script",async:false})}c.jqplot.PyramidRenderer=function(){c.jqplot.LineRenderer.call(this)};c.jqplot.PyramidRenderer.prototype=new c.jqplot.LineRenderer();c.jqplot.PyramidRenderer.prototype.constructor=c.jqplot.PyramidRenderer;c.jqplot.PyramidRenderer.prototype.init=function(j,o){j=j||{};this._type="pyramid";this.barPadding=10;this.barWidth=null;this.fill=true;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.offsetBars=false;if(j.highlightMouseDown&&j.highlightMouseOver==null){j.highlightMouseOver=false}this.side="right";c.extend(true,this,j);this.renderer.options=j;this._highlightedPoint=null;this._dataColors=[];this._barPoints=[];this.fillAxis="y";this._primaryAxis="_yaxis";this._xnudge=0;var n={lineJoin:"miter",lineCap:"butt",fill:this.fill,fillRect:this.fill,isarc:false,strokeStyle:this.color,fillStyle:this.color,closePath:this.fill,lineWidth:this.lineWidth};this.renderer.shapeRenderer.init(n);var m=j.shadowOffset;if(m==null){if(this.lineWidth>2.5){m=1.25*(1+(Math.atan((this.lineWidth/2.5))/0.785398163-1)*0.6)}else{m=1.25*Math.atan((this.lineWidth/2.5))/0.785398163}}var h={lineJoin:"miter",lineCap:"butt",fill:this.fill,fillRect:this.fill,isarc:false,angle:this.shadowAngle,offset:m,alpha:this.shadowAlpha,depth:this.shadowDepth,closePath:this.fill,lineWidth:this.lineWidth};this.renderer.shadowRenderer.init(h);o.postDrawHooks.addOnce(f);o.eventListenerHooks.addOnce("jqplotMouseMove",e);if(this.side==="left"){for(var k=0,g=this.data.length;k<g;k++){this.data[k][1]=-Math.abs(this.data[k][1])}}};c.jqplot.PyramidRenderer.prototype.setGridData=function(p){var j=this._xaxis.series_u2p;var o=this._yaxis.series_u2p;var k=this._plotData;var n=this._prevPlotData;this.gridData=[];this._prevGridData=[];var g=k.length;var m=false;var h;for(h=0;h<g;h++){if(k[h][1]<0){this.side="left"}}if(this._yaxis.name==="yMidAxis"&&this.side==="right"){this._xnudge=this._xaxis.max/2000;m=true}for(h=0;h<g;h++){if(k[h][0]!=null&&k[h][1]!=null){this.gridData.push([j(k[h][1]),o(k[h][0])])}else{if(k[h][0]==null){this.gridData.push([j(k[h][1]),null])}else{if(k[h][1]==null){this.gridData.push(null,[o(k[h][0])])}}}if(k[h][1]===0&&m){this.gridData[h][0]=j(this._xnudge)}}};c.jqplot.PyramidRenderer.prototype.makeGridData=function(m,p){var k=this._xaxis.series_u2p;var o=this._yaxis.series_u2p;var j=[];var g=m.length;var n=false;var h;for(h=0;h<g;h++){if(m[h][1]<0){this.side="left"}}if(this._yaxis.name==="yMidAxis"&&this.side==="right"){this._xnudge=this._xaxis.max/2000;n=true}for(h=0;h<g;h++){if(m[h][0]!=null&&m[h][1]!=null){j.push([k(m[h][1]),o(m[h][0])])}else{if(m[h][0]==null){j.push([k(m[h][1]),null])}else{if(m[h][1]==null){j.push([null,o(m[h][0])])}}}if(m[h][1]===0&&n){j[h][0]=k(this._xnudge)}}return j};c.jqplot.PyramidRenderer.prototype.setBarWidth=function(){var k;var g=0;var h=0;var m=this[this._primaryAxis];var q,l,o;g=m.max-m.min;var n=m.numberTicks;var j=(n-1)/2;var p=(this.barPadding===0)?1:0;if(m.name=="xaxis"||m.name=="x2axis"){this.barWidth=(m._offsets.max-m._offsets.min)/g-this.barPadding+p}else{if(this.fill){this.barWidth=(m._offsets.min-m._offsets.max)/g-this.barPadding+p}else{this.barWidth=(m._offsets.min-m._offsets.max)/g}}};c.jqplot.PyramidRenderer.prototype.draw=function(B,I,k){var E;var u=c.extend({},k);var p=(u.shadow!=undefined)?u.shadow:this.shadow;var K=(u.showLine!=undefined)?u.showLine:this.showLine;var C=(u.fill!=undefined)?u.fill:this.fill;var t=this._xaxis.series_u2p;var G=this._yaxis.series_u2p;var z,x;this._dataColors=[];this._barPoints=[];if(this.renderer.options.barWidth==null){this.renderer.setBarWidth.call(this)}var D=[],s,F;if(K){var q=new c.jqplot.ColorGenerator(this.negativeSeriesColors);var v=new c.jqplot.ColorGenerator(this.seriesColors);var J=q.get(this.index);if(!this.useNegativeColors){J=u.fillStyle}var o=u.fillStyle;var n;var L=this._xaxis.series_u2p(this._xnudge);var j=this._yaxis.series_u2p(this._yaxis.min);var m=this._yaxis.series_u2p(this._yaxis.max);var H=this.barWidth;var y=H/2;var D=[];var r=this.offsetBars?y:0;for(var E=0,A=I.length;E<A;E++){if(this.data[E][0]==null){continue}n=I[E][1];if(this._plotData[E][1]<0){if(this.varyBarColor&&!this._stack){if(this.useNegativeColors){u.fillStyle=q.next()}else{u.fillStyle=v.next()}}}else{if(this.varyBarColor&&!this._stack){u.fillStyle=v.next()}else{u.fillStyle=o}}if(this.fill){if(this._plotData[E][1]>=0){s=I[E][0]-L;F=this.barWidth;D=[L,n-y-r,s,F]}else{s=L-I[E][0];F=this.barWidth;D=[I[E][0],n-y-r,s,F]}this._barPoints.push([[D[0],D[1]+F],[D[0],D[1]],[D[0]+s,D[1]],[D[0]+s,D[1]+F]]);if(p){this.renderer.shadowRenderer.draw(B,D)}var g=u.fillStyle||this.color;this._dataColors.push(g);this.renderer.shapeRenderer.draw(B,D,u)}else{if(E===0){D=[[L,j],[I[E][0],j],[I[E][0],I[E][1]-y-r]]}else{if(E<A-1){D=D.concat([[I[E-1][0],I[E-1][1]-y-r],[I[E][0],I[E][1]+y-r],[I[E][0],I[E][1]-y-r]])}else{D=D.concat([[I[E-1][0],I[E-1][1]-y-r],[I[E][0],I[E][1]+y-r],[I[E][0],m],[L,m]]);if(p){this.renderer.shadowRenderer.draw(B,D)}var g=u.fillStyle||this.color;this._dataColors.push(g);this.renderer.shapeRenderer.draw(B,D,u)}}}}}if(this.highlightColors.length==0){this.highlightColors=c.jqplot.computeHighlightColors(this._dataColors)}else{if(typeof(this.highlightColors)=="string"){this.highlightColors=[];for(var E=0;E<this._dataColors.length;E++){this.highlightColors.push(this.highlightColors)}}}};function b(l,k,h){h=h||{};h.axesDefaults=h.axesDefaults||{};h.grid=h.grid||{};h.legend=h.legend||{};h.seriesDefaults=h.seriesDefaults||{};var g=false;if(h.seriesDefaults.renderer===c.jqplot.PyramidRenderer){g=true}else{if(h.series){for(var j=0;j<h.series.length;j++){if(h.series[j].renderer===c.jqplot.PyramidRenderer){g=true}}}}if(g){h.axesDefaults.renderer=c.jqplot.PyramidAxisRenderer;h.grid.renderer=c.jqplot.PyramidGridRenderer;h.seriesDefaults.pointLabels={show:false}}}function f(){if(this.plugins.pyramidRenderer&&this.plugins.pyramidRenderer.highlightCanvas){this.plugins.pyramidRenderer.highlightCanvas.resetCanvas();this.plugins.pyramidRenderer.highlightCanvas=null}this.plugins.pyramidRenderer={highlightedSeriesIndex:null};this.plugins.pyramidRenderer.highlightCanvas=new c.jqplot.GenericCanvas();this.eventCanvas._elem.before(this.plugins.pyramidRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-pyramidRenderer-highlight-canvas",this._plotDimensions,this));this.plugins.pyramidRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(g){d(g.data.plot)})}function a(m,l,j,i){var h=m.series[l];var g=m.plugins.pyramidRenderer.highlightCanvas;g._ctx.clearRect(0,0,g._ctx.canvas.width,g._ctx.canvas.height);h._highlightedPoint=j;m.plugins.pyramidRenderer.highlightedSeriesIndex=l;var k={fillStyle:h.highlightColors[j],fillRect:false};h.renderer.shapeRenderer.draw(g._ctx,i,k);g=null}function d(j){var g=j.plugins.pyramidRenderer.highlightCanvas;g._ctx.clearRect(0,0,g._ctx.canvas.width,g._ctx.canvas.height);for(var h=0;h<j.series.length;h++){j.series[h]._highlightedPoint=null}j.plugins.pyramidRenderer.highlightedSeriesIndex=null;j.target.trigger("jqplotDataUnhighlight");g=null}function e(k,j,n,m,l){if(m){var i=[m.seriesIndex,m.pointIndex,m.data];var h=jQuery.Event("jqplotDataMouseOver");h.pageX=k.pageX;h.pageY=k.pageY;l.target.trigger(h,i);if(l.series[i[0]].highlightMouseOver&&!(i[0]==l.plugins.pyramidRenderer.highlightedSeriesIndex&&i[1]==l.series[i[0]]._highlightedPoint)){var g=jQuery.Event("jqplotDataHighlight");g.pageX=k.pageX;g.pageY=k.pageY;l.target.trigger(g,i);a(l,m.seriesIndex,m.pointIndex,m.points)}}else{if(m==null){d(l)}}}c.jqplot.preInitHooks.push(b)})(jQuery);
|
@@ -1,222 +1,222 @@
|
|
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
|
-
/**
|
33
|
-
* Class: $.jqplot.Trendline
|
34
|
-
* Plugin which will automatically compute and draw trendlines for plotted data.
|
35
|
-
*/
|
36
|
-
$.jqplot.Trendline = function() {
|
37
|
-
// Group: Properties
|
38
|
-
|
39
|
-
// prop: show
|
40
|
-
// Wether or not to show the trend line.
|
41
|
-
this.show = $.jqplot.config.enablePlugins;
|
42
|
-
// prop: color
|
43
|
-
// CSS color spec for the trend line.
|
44
|
-
// By default this wil be the same color as the primary line.
|
45
|
-
this.color = '#666666';
|
46
|
-
// prop: renderer
|
47
|
-
// Renderer to use to draw the trend line.
|
48
|
-
// The data series that is plotted may not be rendered as a line.
|
49
|
-
// Therefore, we use our own line renderer here to draw a trend line.
|
50
|
-
this.renderer = new $.jqplot.LineRenderer();
|
51
|
-
// prop: rendererOptions
|
52
|
-
// Options to pass to the line renderer.
|
53
|
-
// By default, markers are not shown on trend lines.
|
54
|
-
this.rendererOptions = {marker:{show:false}};
|
55
|
-
// prop: label
|
56
|
-
// Label for the trend line to use in the legend.
|
57
|
-
this.label = '';
|
58
|
-
// prop: type
|
59
|
-
// Either 'exponential', 'exp', or 'linear'.
|
60
|
-
this.type = 'linear';
|
61
|
-
// prop: shadow
|
62
|
-
// true or false, wether or not to show the shadow.
|
63
|
-
this.shadow = true;
|
64
|
-
// prop: markerRenderer
|
65
|
-
// Renderer to use to draw markers on the line.
|
66
|
-
// I think this is wrong.
|
67
|
-
this.markerRenderer = {show:false};
|
68
|
-
// prop: lineWidth
|
69
|
-
// Width of the trend line.
|
70
|
-
this.lineWidth = 1.5;
|
71
|
-
// prop: shadowAngle
|
72
|
-
// Angle of the shadow on the trend line.
|
73
|
-
this.shadowAngle = 45;
|
74
|
-
// prop: shadowOffset
|
75
|
-
// pixel offset for each stroke of the shadow.
|
76
|
-
this.shadowOffset = 1.0;
|
77
|
-
// prop: shadowAlpha
|
78
|
-
// Alpha transparency of the shadow.
|
79
|
-
this.shadowAlpha = 0.07;
|
80
|
-
// prop: shadowDepth
|
81
|
-
// number of strokes to make of the shadow.
|
82
|
-
this.shadowDepth = 3;
|
83
|
-
this.isTrendline = true;
|
84
|
-
|
85
|
-
};
|
86
|
-
|
87
|
-
$.jqplot.postSeriesInitHooks.push(parseTrendLineOptions);
|
88
|
-
$.jqplot.postDrawSeriesHooks.push(drawTrendline);
|
89
|
-
$.jqplot.addLegendRowHooks.push(addTrendlineLegend);
|
90
|
-
|
91
|
-
// called witin scope of the legend object
|
92
|
-
// current series passed in
|
93
|
-
// must return null or an object {label:label, color:color}
|
94
|
-
function addTrendlineLegend(series) {
|
95
|
-
var ret = null;
|
96
|
-
if (series.trendline && series.trendline.show) {
|
97
|
-
var lt = series.trendline.label.toString();
|
98
|
-
if (lt) {
|
99
|
-
ret = {label:lt, color:series.trendline.color};
|
100
|
-
}
|
101
|
-
}
|
102
|
-
return ret;
|
103
|
-
}
|
104
|
-
|
105
|
-
// called within scope of a series
|
106
|
-
function parseTrendLineOptions (target, data, seriesDefaults, options, plot) {
|
107
|
-
if (this._type && (this._type === 'line' || this._type == 'bar')) {
|
108
|
-
this.trendline = new $.jqplot.Trendline();
|
109
|
-
options = options || {};
|
110
|
-
$.extend(true, this.trendline, {color:this.color}, seriesDefaults.trendline, options.trendline);
|
111
|
-
this.trendline.renderer.init.call(this.trendline, null);
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
// called within scope of series object
|
116
|
-
function drawTrendline(sctx, options) {
|
117
|
-
// if we have options, merge trendline options in with precedence
|
118
|
-
options = $.extend(true, {}, this.trendline, options);
|
119
|
-
|
120
|
-
if (this.trendline && options.show) {
|
121
|
-
var fit;
|
122
|
-
// this.renderer.setGridData.call(this);
|
123
|
-
var data = options.data || this.data;
|
124
|
-
fit = fitData(data, this.trendline.type);
|
125
|
-
var gridData = options.gridData || this.renderer.makeGridData.call(this, fit.data);
|
126
|
-
this.trendline.renderer.draw.call(this.trendline, sctx, gridData, {showLine:true, shadow:this.trendline.shadow});
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
function regression(x, y, typ) {
|
131
|
-
var type = (typ == null) ? 'linear' : typ;
|
132
|
-
var N = x.length;
|
133
|
-
var slope;
|
134
|
-
var intercept;
|
135
|
-
var SX = 0;
|
136
|
-
var SY = 0;
|
137
|
-
var SXX = 0;
|
138
|
-
var SXY = 0;
|
139
|
-
var SYY = 0;
|
140
|
-
var Y = [];
|
141
|
-
var X = [];
|
142
|
-
|
143
|
-
if (type == 'linear') {
|
144
|
-
X = x;
|
145
|
-
Y = y;
|
146
|
-
}
|
147
|
-
else if (type == 'exp' || type == 'exponential') {
|
148
|
-
for ( var i=0; i<y.length; i++) {
|
149
|
-
// ignore points <= 0, log undefined.
|
150
|
-
if (y[i] <= 0) {
|
151
|
-
N--;
|
152
|
-
}
|
153
|
-
else {
|
154
|
-
X.push(x[i]);
|
155
|
-
Y.push(Math.log(y[i]));
|
156
|
-
}
|
157
|
-
}
|
158
|
-
}
|
159
|
-
|
160
|
-
for ( var i = 0; i < N; i++) {
|
161
|
-
SX = SX + X[i];
|
162
|
-
SY = SY + Y[i];
|
163
|
-
SXY = SXY + X[i]* Y[i];
|
164
|
-
SXX = SXX + X[i]* X[i];
|
165
|
-
SYY = SYY + Y[i]* Y[i];
|
166
|
-
}
|
167
|
-
|
168
|
-
slope = (N*SXY - SX*SY)/(N*SXX - SX*SX);
|
169
|
-
intercept = (SY - slope*SX)/N;
|
170
|
-
|
171
|
-
return [slope, intercept];
|
172
|
-
}
|
173
|
-
|
174
|
-
function linearRegression(X,Y) {
|
175
|
-
var ret;
|
176
|
-
ret = regression(X,Y,'linear');
|
177
|
-
return [ret[0],ret[1]];
|
178
|
-
}
|
179
|
-
|
180
|
-
function expRegression(X,Y) {
|
181
|
-
var ret;
|
182
|
-
var x = X;
|
183
|
-
var y = Y;
|
184
|
-
ret = regression(x, y,'exp');
|
185
|
-
var base = Math.exp(ret[0]);
|
186
|
-
var coeff = Math.exp(ret[1]);
|
187
|
-
return [base, coeff];
|
188
|
-
}
|
189
|
-
|
190
|
-
function fitData(data, typ) {
|
191
|
-
var type = (typ == null) ? 'linear' : typ;
|
192
|
-
var ret;
|
193
|
-
var res;
|
194
|
-
var x = [];
|
195
|
-
var y = [];
|
196
|
-
var ypred = [];
|
197
|
-
|
198
|
-
for (i=0; i<data.length; i++){
|
199
|
-
if (data[i] != null && data[i][0] != null && data[i][1] != null) {
|
200
|
-
x.push(data[i][0]);
|
201
|
-
y.push(data[i][1]);
|
202
|
-
}
|
203
|
-
}
|
204
|
-
|
205
|
-
if (type == 'linear') {
|
206
|
-
ret = linearRegression(x,y);
|
207
|
-
for ( var i=0; i<x.length; i++){
|
208
|
-
res = ret[0]*x[i] + ret[1];
|
209
|
-
ypred.push([x[i], res]);
|
210
|
-
}
|
211
|
-
}
|
212
|
-
else if (type == 'exp' || type == 'exponential') {
|
213
|
-
ret = expRegression(x,y);
|
214
|
-
for ( var i=0; i<x.length; i++){
|
215
|
-
res = ret[1]*Math.pow(ret[0],x[i]);
|
216
|
-
ypred.push([x[i], res]);
|
217
|
-
}
|
218
|
-
}
|
219
|
-
return {data: ypred, slope: ret[0], intercept: ret[1]};
|
220
|
-
}
|
221
|
-
|
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
|
+
/**
|
33
|
+
* Class: $.jqplot.Trendline
|
34
|
+
* Plugin which will automatically compute and draw trendlines for plotted data.
|
35
|
+
*/
|
36
|
+
$.jqplot.Trendline = function() {
|
37
|
+
// Group: Properties
|
38
|
+
|
39
|
+
// prop: show
|
40
|
+
// Wether or not to show the trend line.
|
41
|
+
this.show = $.jqplot.config.enablePlugins;
|
42
|
+
// prop: color
|
43
|
+
// CSS color spec for the trend line.
|
44
|
+
// By default this wil be the same color as the primary line.
|
45
|
+
this.color = '#666666';
|
46
|
+
// prop: renderer
|
47
|
+
// Renderer to use to draw the trend line.
|
48
|
+
// The data series that is plotted may not be rendered as a line.
|
49
|
+
// Therefore, we use our own line renderer here to draw a trend line.
|
50
|
+
this.renderer = new $.jqplot.LineRenderer();
|
51
|
+
// prop: rendererOptions
|
52
|
+
// Options to pass to the line renderer.
|
53
|
+
// By default, markers are not shown on trend lines.
|
54
|
+
this.rendererOptions = {marker:{show:false}};
|
55
|
+
// prop: label
|
56
|
+
// Label for the trend line to use in the legend.
|
57
|
+
this.label = '';
|
58
|
+
// prop: type
|
59
|
+
// Either 'exponential', 'exp', or 'linear'.
|
60
|
+
this.type = 'linear';
|
61
|
+
// prop: shadow
|
62
|
+
// true or false, wether or not to show the shadow.
|
63
|
+
this.shadow = true;
|
64
|
+
// prop: markerRenderer
|
65
|
+
// Renderer to use to draw markers on the line.
|
66
|
+
// I think this is wrong.
|
67
|
+
this.markerRenderer = {show:false};
|
68
|
+
// prop: lineWidth
|
69
|
+
// Width of the trend line.
|
70
|
+
this.lineWidth = 1.5;
|
71
|
+
// prop: shadowAngle
|
72
|
+
// Angle of the shadow on the trend line.
|
73
|
+
this.shadowAngle = 45;
|
74
|
+
// prop: shadowOffset
|
75
|
+
// pixel offset for each stroke of the shadow.
|
76
|
+
this.shadowOffset = 1.0;
|
77
|
+
// prop: shadowAlpha
|
78
|
+
// Alpha transparency of the shadow.
|
79
|
+
this.shadowAlpha = 0.07;
|
80
|
+
// prop: shadowDepth
|
81
|
+
// number of strokes to make of the shadow.
|
82
|
+
this.shadowDepth = 3;
|
83
|
+
this.isTrendline = true;
|
84
|
+
|
85
|
+
};
|
86
|
+
|
87
|
+
$.jqplot.postSeriesInitHooks.push(parseTrendLineOptions);
|
88
|
+
$.jqplot.postDrawSeriesHooks.push(drawTrendline);
|
89
|
+
$.jqplot.addLegendRowHooks.push(addTrendlineLegend);
|
90
|
+
|
91
|
+
// called witin scope of the legend object
|
92
|
+
// current series passed in
|
93
|
+
// must return null or an object {label:label, color:color}
|
94
|
+
function addTrendlineLegend(series) {
|
95
|
+
var ret = null;
|
96
|
+
if (series.trendline && series.trendline.show) {
|
97
|
+
var lt = series.trendline.label.toString();
|
98
|
+
if (lt) {
|
99
|
+
ret = {label:lt, color:series.trendline.color};
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return ret;
|
103
|
+
}
|
104
|
+
|
105
|
+
// called within scope of a series
|
106
|
+
function parseTrendLineOptions (target, data, seriesDefaults, options, plot) {
|
107
|
+
if (this._type && (this._type === 'line' || this._type == 'bar')) {
|
108
|
+
this.trendline = new $.jqplot.Trendline();
|
109
|
+
options = options || {};
|
110
|
+
$.extend(true, this.trendline, {color:this.color}, seriesDefaults.trendline, options.trendline);
|
111
|
+
this.trendline.renderer.init.call(this.trendline, null);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
// called within scope of series object
|
116
|
+
function drawTrendline(sctx, options) {
|
117
|
+
// if we have options, merge trendline options in with precedence
|
118
|
+
options = $.extend(true, {}, this.trendline, options);
|
119
|
+
|
120
|
+
if (this.trendline && options.show) {
|
121
|
+
var fit;
|
122
|
+
// this.renderer.setGridData.call(this);
|
123
|
+
var data = options.data || this.data;
|
124
|
+
fit = fitData(data, this.trendline.type);
|
125
|
+
var gridData = options.gridData || this.renderer.makeGridData.call(this, fit.data);
|
126
|
+
this.trendline.renderer.draw.call(this.trendline, sctx, gridData, {showLine:true, shadow:this.trendline.shadow});
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
function regression(x, y, typ) {
|
131
|
+
var type = (typ == null) ? 'linear' : typ;
|
132
|
+
var N = x.length;
|
133
|
+
var slope;
|
134
|
+
var intercept;
|
135
|
+
var SX = 0;
|
136
|
+
var SY = 0;
|
137
|
+
var SXX = 0;
|
138
|
+
var SXY = 0;
|
139
|
+
var SYY = 0;
|
140
|
+
var Y = [];
|
141
|
+
var X = [];
|
142
|
+
|
143
|
+
if (type == 'linear') {
|
144
|
+
X = x;
|
145
|
+
Y = y;
|
146
|
+
}
|
147
|
+
else if (type == 'exp' || type == 'exponential') {
|
148
|
+
for ( var i=0; i<y.length; i++) {
|
149
|
+
// ignore points <= 0, log undefined.
|
150
|
+
if (y[i] <= 0) {
|
151
|
+
N--;
|
152
|
+
}
|
153
|
+
else {
|
154
|
+
X.push(x[i]);
|
155
|
+
Y.push(Math.log(y[i]));
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
for ( var i = 0; i < N; i++) {
|
161
|
+
SX = SX + X[i];
|
162
|
+
SY = SY + Y[i];
|
163
|
+
SXY = SXY + X[i]* Y[i];
|
164
|
+
SXX = SXX + X[i]* X[i];
|
165
|
+
SYY = SYY + Y[i]* Y[i];
|
166
|
+
}
|
167
|
+
|
168
|
+
slope = (N*SXY - SX*SY)/(N*SXX - SX*SX);
|
169
|
+
intercept = (SY - slope*SX)/N;
|
170
|
+
|
171
|
+
return [slope, intercept];
|
172
|
+
}
|
173
|
+
|
174
|
+
function linearRegression(X,Y) {
|
175
|
+
var ret;
|
176
|
+
ret = regression(X,Y,'linear');
|
177
|
+
return [ret[0],ret[1]];
|
178
|
+
}
|
179
|
+
|
180
|
+
function expRegression(X,Y) {
|
181
|
+
var ret;
|
182
|
+
var x = X;
|
183
|
+
var y = Y;
|
184
|
+
ret = regression(x, y,'exp');
|
185
|
+
var base = Math.exp(ret[0]);
|
186
|
+
var coeff = Math.exp(ret[1]);
|
187
|
+
return [base, coeff];
|
188
|
+
}
|
189
|
+
|
190
|
+
function fitData(data, typ) {
|
191
|
+
var type = (typ == null) ? 'linear' : typ;
|
192
|
+
var ret;
|
193
|
+
var res;
|
194
|
+
var x = [];
|
195
|
+
var y = [];
|
196
|
+
var ypred = [];
|
197
|
+
|
198
|
+
for (i=0; i<data.length; i++){
|
199
|
+
if (data[i] != null && data[i][0] != null && data[i][1] != null) {
|
200
|
+
x.push(data[i][0]);
|
201
|
+
y.push(data[i][1]);
|
202
|
+
}
|
203
|
+
}
|
204
|
+
|
205
|
+
if (type == 'linear') {
|
206
|
+
ret = linearRegression(x,y);
|
207
|
+
for ( var i=0; i<x.length; i++){
|
208
|
+
res = ret[0]*x[i] + ret[1];
|
209
|
+
ypred.push([x[i], res]);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
else if (type == 'exp' || type == 'exponential') {
|
213
|
+
ret = expRegression(x,y);
|
214
|
+
for ( var i=0; i<x.length; i++){
|
215
|
+
res = ret[1]*Math.pow(ret[0],x[i]);
|
216
|
+
ypred.push([x[i], res]);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
return {data: ypred, slope: ret[0], intercept: ret[1]};
|
220
|
+
}
|
221
|
+
|
222
222
|
})(jQuery);
|