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(e){e.jqplot.DonutRenderer=function(){e.jqplot.LineRenderer.call(this)};e.jqplot.DonutRenderer.prototype=new e.jqplot.LineRenderer();e.jqplot.DonutRenderer.prototype.constructor=e.jqplot.DonutRenderer;e.jqplot.DonutRenderer.prototype.init=function(p,t){this.diameter=null;this.innerDiameter=null;this.thickness=null;this.padding=20;this.sliceMargin=0;this.ringMargin=null;this.fill=true;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=5;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.dataLabels="percent";this.showDataLabels=false;this.dataLabelFormatString=null;this.dataLabelThreshold=3;this.dataLabelPositionFactor=0.4;this.dataLabelNudge=0;this.startAngle=0;this.tickRenderer=e.jqplot.DonutTickRenderer;this._drawData=true;this._type="donut";if(p.highlightMouseDown&&p.highlightMouseOver==null){p.highlightMouseOver=false}e.extend(true,this,p);if(this.diameter!=null){this.diameter=this.diameter-this.sliceMargin}this._diameter=null;this._innerDiameter=null;this._radius=null;this._innerRadius=null;this._thickness=null;this._previousSeries=[];this._numberSeries=1;this._sliceAngles=[];this._highlightedPoint=null;if(this.highlightColors.length==0){for(var r=0;r<this.seriesColors.length;r++){var q=e.jqplot.getColorComponents(this.seriesColors[r]);var n=[q[0],q[1],q[2]];var s=n[0]+n[1]+n[2];for(var o=0;o<3;o++){n[o]=(s>570)?n[o]*0.8:n[o]+0.3*(255-n[o]);n[o]=parseInt(n[o],10)}this.highlightColors.push("rgb("+n[0]+","+n[1]+","+n[2]+")")}}t.postParseOptionsHooks.addOnce(l);t.postInitHooks.addOnce(g);t.eventListenerHooks.addOnce("jqplotMouseMove",b);t.eventListenerHooks.addOnce("jqplotMouseDown",a);t.eventListenerHooks.addOnce("jqplotMouseUp",j);t.eventListenerHooks.addOnce("jqplotClick",f);t.eventListenerHooks.addOnce("jqplotRightClick",m);t.postDrawHooks.addOnce(h)};e.jqplot.DonutRenderer.prototype.setGridData=function(s){var o=[];var t=[];var n=this.startAngle/180*Math.PI;var r=0;this._drawData=false;for(var q=0;q<this.data.length;q++){if(this.data[q][1]!=0){this._drawData=true}o.push(this.data[q][1]);t.push([this.data[q][0]]);if(q>0){o[q]+=o[q-1]}r+=this.data[q][1]}var p=Math.PI*2/o[o.length-1];for(var q=0;q<o.length;q++){t[q][1]=o[q]*p;t[q][2]=this.data[q][1]/r}this.gridData=t};e.jqplot.DonutRenderer.prototype.makeGridData=function(s,t){var o=[];var u=[];var r=0;var n=this.startAngle/180*Math.PI;this._drawData=false;for(var q=0;q<s.length;q++){if(this.data[q][1]!=0){this._drawData=true}o.push(s[q][1]);u.push([s[q][0]]);if(q>0){o[q]+=o[q-1]}r+=s[q][1]}var p=Math.PI*2/o[o.length-1];for(var q=0;q<o.length;q++){u[q][1]=o[q]*p;u[q][2]=s[q][1]/r}return u};e.jqplot.DonutRenderer.prototype.drawSlice=function(x,u,t,p,s){var n=this._diameter/2;var v=n-this._thickness;var w=this.fill;x.save();x.translate(this._center[0],this._center[1]);if(s){for(var q=0;q<this.shadowDepth;q++){x.save();x.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));o()}}else{o()}function o(){if(t>6.282+this.startAngle){t=6.282+this.startAngle;if(u>t){u=6.281+this.startAngle}}if(u>=t){return}x.beginPath();x.fillStyle=p;x.strokeStyle=p;x.arc(0,0,n,u,t,false);x.lineTo(v*Math.cos(t),v*Math.sin(t));x.arc(0,0,v,t,u,true);x.closePath();if(w){x.fill()}else{x.stroke()}}if(s){for(var q=0;q<this.shadowDepth;q++){x.restore()}}x.restore()};e.jqplot.DonutRenderer.prototype.draw=function(N,V,t,P){var Q;var J=(t!=undefined)?t:{};var q=0;var p=0;var u=1;if(t.legendInfo&&t.legendInfo.placement=="insideGrid"){var I=t.legendInfo;switch(I.location){case"nw":q=I.width+I.xoffset;break;case"w":q=I.width+I.xoffset;break;case"sw":q=I.width+I.xoffset;break;case"ne":q=I.width+I.xoffset;u=-1;break;case"e":q=I.width+I.xoffset;u=-1;break;case"se":q=I.width+I.xoffset;u=-1;break;case"n":p=I.height+I.yoffset;break;case"s":p=I.height+I.yoffset;u=-1;break;default:break}}var B=(J.shadow!=undefined)?J.shadow:this.shadow;var W=(J.showLine!=undefined)?J.showLine:this.showLine;var O=(J.fill!=undefined)?J.fill:this.fill;var s=N.canvas.width;var H=N.canvas.height;var G=s-q-2*this.padding;var R=H-p-2*this.padding;var v=Math.min(G,R);var T=v;var X=(this.ringMargin==null)?this.sliceMargin*2:this.ringMargin;for(var Q=0;Q<this._previousSeries.length;Q++){T-=2*this._previousSeries[Q]._thickness+2*X}this._diameter=this.diameter||T;if(this.innerDiameter!=null){var M=(this._numberSeries>1&&this.index>0)?this._previousSeries[0]._diameter:this._diameter;this._thickness=this.thickness||(M-this.innerDiameter-2*X*this._numberSeries)/this._numberSeries/2}else{this._thickness=this.thickness||v/2/(this._numberSeries+1)*0.85}var K=this._radius=this._diameter/2;this._innerRadius=this._radius-this._thickness;var o=this.startAngle/180*Math.PI;this._center=[(s-u*q)/2+u*q,(H-u*p)/2+u*p];if(this.shadow){var L="rgba(0,0,0,"+this.shadowAlpha+")";for(var Q=0;Q<V.length;Q++){var A=(Q==0)?o:V[Q-1][1]+o;A+=this.sliceMargin/180*Math.PI;this.renderer.drawSlice.call(this,N,A,V[Q][1]+o,L,true)}}for(var Q=0;Q<V.length;Q++){var A=(Q==0)?o:V[Q-1][1]+o;A+=this.sliceMargin/180*Math.PI;var z=V[Q][1]+o;this._sliceAngles.push([A,z]);this.renderer.drawSlice.call(this,N,A,z,this.seriesColors[Q],false);if(this.showDataLabels&&V[Q][2]*100>=this.dataLabelThreshold){var S,U=(A+z)/2,C;if(this.dataLabels=="label"){S=this.dataLabelFormatString||"%s";C=e.jqplot.sprintf(S,V[Q][0])}else{if(this.dataLabels=="value"){S=this.dataLabelFormatString||"%d";C=e.jqplot.sprintf(S,this.data[Q][1])}else{if(this.dataLabels=="percent"){S=this.dataLabelFormatString||"%d%%";C=e.jqplot.sprintf(S,V[Q][2]*100)}else{if(this.dataLabels.constructor==Array){S=this.dataLabelFormatString||"%s";C=e.jqplot.sprintf(S,this.dataLabels[Q])}}}}var n=this._innerRadius+this._thickness*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge;var F=this._center[0]+Math.cos(U)*n+this.canvas._offsets.left;var E=this._center[1]+Math.sin(U)*n+this.canvas._offsets.top;var D=e('<span class="jqplot-donut-series jqplot-data-label" style="position:absolute;">'+C+"</span>").insertBefore(P.eventCanvas._elem);F-=D.width()/2;E-=D.height()/2;F=Math.round(F);E=Math.round(E);D.css({left:F,top:E})}}};e.jqplot.DonutAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.DonutAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.DonutAxisRenderer.prototype.constructor=e.jqplot.DonutAxisRenderer;e.jqplot.DonutAxisRenderer.prototype.init=function(n){this.tickRenderer=e.jqplot.DonutTickRenderer;e.extend(true,this,n);this._dataBounds={min:0,max:100};this.min=0;this.max=100;this.showTicks=false;this.ticks=[];this.showMark=false;this.show=false};e.jqplot.DonutLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)};e.jqplot.DonutLegendRenderer.prototype=new e.jqplot.TableLegendRenderer();e.jqplot.DonutLegendRenderer.prototype.constructor=e.jqplot.DonutLegendRenderer;e.jqplot.DonutLegendRenderer.prototype.init=function(n){this.numberRows=null;this.numberColumns=null;e.extend(true,this,n)};e.jqplot.DonutLegendRenderer.prototype.draw=function(){var q=this;if(this.show){var y=this._series;var B="position:absolute;";B+=(this.background)?"background:"+this.background+";":"";B+=(this.border)?"border:"+this.border+";":"";B+=(this.fontSize)?"font-size:"+this.fontSize+";":"";B+=(this.fontFamily)?"font-family:"+this.fontFamily+";":"";B+=(this.textColor)?"color:"+this.textColor+";":"";B+=(this.marginTop!=null)?"margin-top:"+this.marginTop+";":"";B+=(this.marginBottom!=null)?"margin-bottom:"+this.marginBottom+";":"";B+=(this.marginLeft!=null)?"margin-left:"+this.marginLeft+";":"";B+=(this.marginRight!=null)?"margin-right:"+this.marginRight+";":"";this._elem=e('<table class="jqplot-table-legend" style="'+B+'"></table>');var F=false,x=false,n,v;var z=y[0];var o=new e.jqplot.ColorGenerator(z.seriesColors);if(z.show){var G=z.data;if(this.numberRows){n=this.numberRows;if(!this.numberColumns){v=Math.ceil(G.length/n)}else{v=this.numberColumns}}else{if(this.numberColumns){v=this.numberColumns;n=Math.ceil(G.length/this.numberColumns)}else{n=G.length;v=1}}var E,D,p,t,r,u,w,C;var A=0;for(E=0;E<n;E++){if(x){p=e('<tr class="jqplot-table-legend"></tr>').prependTo(this._elem)}else{p=e('<tr class="jqplot-table-legend"></tr>').appendTo(this._elem)}for(D=0;D<v;D++){if(A<G.length){u=this.labels[A]||G[A][0].toString();C=o.next();if(!x){if(E>0){F=true}else{F=false}}else{if(E==n-1){F=false}else{F=true}}w=(F)?this.rowSpacing:"0";t=e('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+w+';"><div><div class="jqplot-table-legend-swatch" style="border-color:'+C+';"></div></div></td>');r=e('<td class="jqplot-table-legend" style="padding-top:'+w+';"></td>');if(this.escapeHtml){r.text(u)}else{r.html(u)}if(x){r.prependTo(p);t.prependTo(p)}else{t.appendTo(p);r.appendTo(p)}F=true}A++}}}}return this._elem};function c(r,q,o){o=o||{};o.axesDefaults=o.axesDefaults||{};o.legend=o.legend||{};o.seriesDefaults=o.seriesDefaults||{};var n=false;if(o.seriesDefaults.renderer==e.jqplot.DonutRenderer){n=true}else{if(o.series){for(var p=0;p<o.series.length;p++){if(o.series[p].renderer==e.jqplot.DonutRenderer){n=true}}}}if(n){o.axesDefaults.renderer=e.jqplot.DonutAxisRenderer;o.legend.renderer=e.jqplot.DonutLegendRenderer;o.legend.preDraw=true;o.seriesDefaults.pointLabels={show:false}}}function g(r,q,o){for(var p=1;p<this.series.length;p++){if(!this.series[p]._previousSeries.length){for(var n=0;n<p;n++){if(this.series[p].renderer.constructor==e.jqplot.DonutRenderer&&this.series[n].renderer.constructor==e.jqplot.DonutRenderer){this.series[p]._previousSeries.push(this.series[n])}}}}for(p=0;p<this.series.length;p++){if(this.series[p].renderer.constructor==e.jqplot.DonutRenderer){this.series[p]._numberSeries=this.series.length;if(this.series[p].highlightMouseOver){this.series[p].highlightMouseDown=false}}}}var k=false;function l(n){for(var o=0;o<this.series.length;o++){this.series[o].seriesColors=this.seriesColors;this.series[o].colorGenerator=e.jqplot.colorGenerator}}function d(r,q,p){var o=r.series[q];var n=r.plugins.donutRenderer.highlightCanvas;n._ctx.clearRect(0,0,n._ctx.canvas.width,n._ctx.canvas.height);o._highlightedPoint=p;r.plugins.donutRenderer.highlightedSeriesIndex=q;o.renderer.drawSlice.call(o,n._ctx,o._sliceAngles[p][0],o._sliceAngles[p][1],o.highlightColors[p],false)}function i(p){var n=p.plugins.donutRenderer.highlightCanvas;n._ctx.clearRect(0,0,n._ctx.canvas.width,n._ctx.canvas.height);for(var o=0;o<p.series.length;o++){p.series[o]._highlightedPoint=null}p.plugins.donutRenderer.highlightedSeriesIndex=null;p.target.trigger("jqplotDataUnhighlight")}function b(r,q,u,t,s){if(t){var p=[t.seriesIndex,t.pointIndex,t.data];var o=jQuery.Event("jqplotDataMouseOver");o.pageX=r.pageX;o.pageY=r.pageY;s.target.trigger(o,p);if(s.series[p[0]].highlightMouseOver&&!(p[0]==s.plugins.donutRenderer.highlightedSeriesIndex&&p[1]==s.series[p[0]]._highlightedPoint)){var n=jQuery.Event("jqplotDataHighlight");n.pageX=r.pageX;n.pageY=r.pageY;s.target.trigger(n,p);d(s,p[0],p[1])}}else{if(t==null){i(s)}}}function a(q,p,t,s,r){if(s){var o=[s.seriesIndex,s.pointIndex,s.data];if(r.series[o[0]].highlightMouseDown&&!(o[0]==r.plugins.donutRenderer.highlightedSeriesIndex&&o[1]==r.series[o[0]]._highlightedPoint)){var n=jQuery.Event("jqplotDataHighlight");n.pageX=q.pageX;n.pageY=q.pageY;r.target.trigger(n,o);d(r,o[0],o[1])}}else{if(s==null){i(r)}}}function j(p,o,s,r,q){var n=q.plugins.donutRenderer.highlightedSeriesIndex;if(n!=null&&q.series[n].highlightMouseDown){i(q)}}function f(q,p,t,s,r){if(s){var o=[s.seriesIndex,s.pointIndex,s.data];var n=jQuery.Event("jqplotDataClick");n.pageX=q.pageX;n.pageY=q.pageY;r.target.trigger(n,o)}}function m(r,q,u,t,s){if(t){var p=[t.seriesIndex,t.pointIndex,t.data];var n=s.plugins.donutRenderer.highlightedSeriesIndex;if(n!=null&&s.series[n].highlightMouseDown){i(s)}var o=jQuery.Event("jqplotDataRightClick");o.pageX=r.pageX;o.pageY=r.pageY;s.target.trigger(o,p)}}function h(){if(this.plugins.donutRenderer&&this.plugins.donutRenderer.highlightCanvas){this.plugins.donutRenderer.highlightCanvas.resetCanvas();this.plugins.donutRenderer.highlightCanvas=null}this.plugins.donutRenderer={highlightedSeriesIndex:null};this.plugins.donutRenderer.highlightCanvas=new e.jqplot.GenericCanvas();var o=e(this.targetId+" .jqplot-data-label");if(o.length){e(o[0]).before(this.plugins.donutRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-donutRenderer-highlight-canvas",this._plotDimensions,this))}else{this.eventCanvas._elem.before(this.plugins.donutRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-donutRenderer-highlight-canvas",this._plotDimensions,this))}var n=this.plugins.donutRenderer.highlightCanvas.setContext();this.eventCanvas._elem.bind("mouseleave",{plot:this},function(p){i(p.data.plot)})}e.jqplot.preInitHooks.push(c);e.jqplot.DonutTickRenderer=function(){e.jqplot.AxisTickRenderer.call(this)};e.jqplot.DonutTickRenderer.prototype=new e.jqplot.AxisTickRenderer();e.jqplot.DonutTickRenderer.prototype.constructor=e.jqplot.DonutTickRenderer})(jQuery);
@@ -1,224 +1,224 @@
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.Dragable
34
- * Plugin to make plotted points dragable by the user.
35
- */
36
- $.jqplot.Dragable = function(options) {
37
- // Group: Properties
38
- this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false});
39
- this.shapeRenderer = new $.jqplot.ShapeRenderer();
40
- this.isDragging = false;
41
- this.isOver = false;
42
- this._ctx;
43
- this._elem;
44
- this._point;
45
- this._gridData;
46
- // prop: color
47
- // CSS color spec for the dragged point (and adjacent line segment or bar).
48
- this.color;
49
- // prop: constrainTo
50
- // Constrain dragging motion to an axis or to none.
51
- // Allowable values are 'none', 'x', 'y'
52
- this.constrainTo = 'none'; // 'x', 'y', or 'none';
53
- $.extend(true, this, options);
54
- };
55
-
56
- function DragCanvas() {
57
- $.jqplot.GenericCanvas.call(this);
58
- this.isDragging = false;
59
- this.isOver = false;
60
- this._neighbor;
61
- this._cursors = [];
62
- }
63
-
64
- DragCanvas.prototype = new $.jqplot.GenericCanvas();
65
- DragCanvas.prototype.constructor = DragCanvas;
66
-
67
-
68
- // called within scope of series
69
- $.jqplot.Dragable.parseOptions = function (defaults, opts) {
70
- var options = opts || {};
71
- this.plugins.dragable = new $.jqplot.Dragable(options.dragable);
72
- // since this function is called before series options are parsed,
73
- // we can set this here and it will be overridden if needed.
74
- this.isDragable = $.jqplot.config.enablePlugins;
75
- };
76
-
77
- // called within context of plot
78
- // create a canvas which we can draw on.
79
- // insert it before the eventCanvas, so eventCanvas will still capture events.
80
- // add a new DragCanvas object to the plot plugins to handle drawing on this new canvas.
81
- $.jqplot.Dragable.postPlotDraw = function() {
82
- // Memory Leaks patch
83
- if (this.plugins.dragable && this.plugins.dragable.highlightCanvas) {
84
- this.plugins.dragable.highlightCanvas.resetCanvas();
85
- this.plugins.dragable.highlightCanvas = null;
86
- }
87
-
88
- this.plugins.dragable = {previousCursor:'auto', isOver:false};
89
- this.plugins.dragable.dragCanvas = new DragCanvas();
90
-
91
- this.eventCanvas._elem.before(this.plugins.dragable.dragCanvas.createElement(this._gridPadding, 'jqplot-dragable-canvas', this._plotDimensions, this));
92
- var dctx = this.plugins.dragable.dragCanvas.setContext();
93
- };
94
-
95
- //$.jqplot.preInitHooks.push($.jqplot.Dragable.init);
96
- $.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Dragable.parseOptions);
97
- $.jqplot.postDrawHooks.push($.jqplot.Dragable.postPlotDraw);
98
- $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
99
- $.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleDown]);
100
- $.jqplot.eventListenerHooks.push(['jqplotMouseUp', handleUp]);
101
-
102
-
103
- function initDragPoint(plot, neighbor) {
104
- var s = plot.series[neighbor.seriesIndex];
105
- var drag = s.plugins.dragable;
106
-
107
- // first, init the mark renderer for the dragged point
108
- var smr = s.markerRenderer;
109
- var mr = drag.markerRenderer;
110
- mr.style = smr.style;
111
- mr.lineWidth = smr.lineWidth + 2.5;
112
- mr.size = smr.size + 5;
113
- if (!drag.color) {
114
- var rgba = $.jqplot.getColorComponents(smr.color);
115
- var newrgb = [rgba[0], rgba[1], rgba[2]];
116
- var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
117
- drag.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
118
- }
119
- mr.color = drag.color;
120
- mr.init();
121
-
122
- var start = (neighbor.pointIndex > 0) ? neighbor.pointIndex - 1 : 0;
123
- var end = neighbor.pointIndex+2;
124
- drag._gridData = s.gridData.slice(start, end);
125
- }
126
-
127
- function handleMove(ev, gridpos, datapos, neighbor, plot) {
128
- if (plot.plugins.dragable.dragCanvas.isDragging) {
129
- var dc = plot.plugins.dragable.dragCanvas;
130
- var dp = dc._neighbor;
131
- var s = plot.series[dp.seriesIndex];
132
- var drag = s.plugins.dragable;
133
- var gd = s.gridData;
134
-
135
- // compute the new grid position with any constraints.
136
- var x = (drag.constrainTo == 'y') ? dp.gridData[0] : gridpos.x;
137
- var y = (drag.constrainTo == 'x') ? dp.gridData[1] : gridpos.y;
138
-
139
- // compute data values for any listeners.
140
- var xu = s._xaxis.series_p2u(x);
141
- var yu = s._yaxis.series_p2u(y);
142
-
143
- // clear the canvas then redraw effect at new position.
144
- var ctx = dc._ctx;
145
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
146
-
147
- // adjust our gridData for the new mouse position
148
- if (dp.pointIndex > 0) {
149
- drag._gridData[1] = [x, y];
150
- }
151
- else {
152
- drag._gridData[0] = [x, y];
153
- }
154
- plot.series[dp.seriesIndex].draw(dc._ctx, {gridData:drag._gridData, shadow:false, preventJqPlotSeriesDrawTrigger:true, color:drag.color, markerOptions:{color:drag.color, shadow:false}, trendline:{show:false}});
155
- plot.target.trigger('jqplotSeriesPointChange', [dp.seriesIndex, dp.pointIndex, [xu,yu], [x,y]]);
156
- }
157
- else if (neighbor != null) {
158
- var series = plot.series[neighbor.seriesIndex];
159
- if (series.isDragable) {
160
- var dc = plot.plugins.dragable.dragCanvas;
161
- if (!dc.isOver) {
162
- dc._cursors.push(ev.target.style.cursor);
163
- ev.target.style.cursor = "pointer";
164
- }
165
- dc.isOver = true;
166
- }
167
- }
168
- else if (neighbor == null) {
169
- var dc = plot.plugins.dragable.dragCanvas;
170
- if (dc.isOver) {
171
- ev.target.style.cursor = dc._cursors.pop();
172
- dc.isOver = false;
173
- }
174
- }
175
- }
176
-
177
- function handleDown(ev, gridpos, datapos, neighbor, plot) {
178
- var dc = plot.plugins.dragable.dragCanvas;
179
- dc._cursors.push(ev.target.style.cursor);
180
- if (neighbor != null) {
181
- var s = plot.series[neighbor.seriesIndex];
182
- var drag = s.plugins.dragable;
183
- if (s.isDragable && !dc.isDragging) {
184
- dc._neighbor = neighbor;
185
- dc.isDragging = true;
186
- initDragPoint(plot, neighbor);
187
- drag.markerRenderer.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], dc._ctx);
188
- ev.target.style.cursor = "move";
189
- plot.target.trigger('jqplotDragStart', [neighbor.seriesIndex, neighbor.pointIndex, gridpos, datapos]);
190
- }
191
- }
192
- // Just in case of a hickup, we'll clear the drag canvas and reset.
193
- else {
194
- var ctx = dc._ctx;
195
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
196
- dc.isDragging = false;
197
- }
198
- }
199
-
200
- function handleUp(ev, gridpos, datapos, neighbor, plot) {
201
- if (plot.plugins.dragable.dragCanvas.isDragging) {
202
- var dc = plot.plugins.dragable.dragCanvas;
203
- // clear the canvas
204
- var ctx = dc._ctx;
205
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
206
- dc.isDragging = false;
207
- // redraw the series canvas at the new point.
208
- var dp = dc._neighbor;
209
- var s = plot.series[dp.seriesIndex];
210
- var drag = s.plugins.dragable;
211
- // compute the new grid position with any constraints.
212
- var x = (drag.constrainTo == 'y') ? dp.data[0] : datapos[s.xaxis];
213
- var y = (drag.constrainTo == 'x') ? dp.data[1] : datapos[s.yaxis];
214
- // var x = datapos[s.xaxis];
215
- // var y = datapos[s.yaxis];
216
- s.data[dp.pointIndex][0] = x;
217
- s.data[dp.pointIndex][1] = y;
218
- plot.drawSeries({preventJqPlotSeriesDrawTrigger:true}, dp.seriesIndex);
219
- dc._neighbor = null;
220
- ev.target.style.cursor = dc._cursors.pop();
221
- plot.target.trigger('jqplotDragStop', [gridpos, datapos]);
222
- }
223
- }
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.Dragable
34
+ * Plugin to make plotted points dragable by the user.
35
+ */
36
+ $.jqplot.Dragable = function(options) {
37
+ // Group: Properties
38
+ this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false});
39
+ this.shapeRenderer = new $.jqplot.ShapeRenderer();
40
+ this.isDragging = false;
41
+ this.isOver = false;
42
+ this._ctx;
43
+ this._elem;
44
+ this._point;
45
+ this._gridData;
46
+ // prop: color
47
+ // CSS color spec for the dragged point (and adjacent line segment or bar).
48
+ this.color;
49
+ // prop: constrainTo
50
+ // Constrain dragging motion to an axis or to none.
51
+ // Allowable values are 'none', 'x', 'y'
52
+ this.constrainTo = 'none'; // 'x', 'y', or 'none';
53
+ $.extend(true, this, options);
54
+ };
55
+
56
+ function DragCanvas() {
57
+ $.jqplot.GenericCanvas.call(this);
58
+ this.isDragging = false;
59
+ this.isOver = false;
60
+ this._neighbor;
61
+ this._cursors = [];
62
+ }
63
+
64
+ DragCanvas.prototype = new $.jqplot.GenericCanvas();
65
+ DragCanvas.prototype.constructor = DragCanvas;
66
+
67
+
68
+ // called within scope of series
69
+ $.jqplot.Dragable.parseOptions = function (defaults, opts) {
70
+ var options = opts || {};
71
+ this.plugins.dragable = new $.jqplot.Dragable(options.dragable);
72
+ // since this function is called before series options are parsed,
73
+ // we can set this here and it will be overridden if needed.
74
+ this.isDragable = $.jqplot.config.enablePlugins;
75
+ };
76
+
77
+ // called within context of plot
78
+ // create a canvas which we can draw on.
79
+ // insert it before the eventCanvas, so eventCanvas will still capture events.
80
+ // add a new DragCanvas object to the plot plugins to handle drawing on this new canvas.
81
+ $.jqplot.Dragable.postPlotDraw = function() {
82
+ // Memory Leaks patch
83
+ if (this.plugins.dragable && this.plugins.dragable.highlightCanvas) {
84
+ this.plugins.dragable.highlightCanvas.resetCanvas();
85
+ this.plugins.dragable.highlightCanvas = null;
86
+ }
87
+
88
+ this.plugins.dragable = {previousCursor:'auto', isOver:false};
89
+ this.plugins.dragable.dragCanvas = new DragCanvas();
90
+
91
+ this.eventCanvas._elem.before(this.plugins.dragable.dragCanvas.createElement(this._gridPadding, 'jqplot-dragable-canvas', this._plotDimensions, this));
92
+ var dctx = this.plugins.dragable.dragCanvas.setContext();
93
+ };
94
+
95
+ //$.jqplot.preInitHooks.push($.jqplot.Dragable.init);
96
+ $.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Dragable.parseOptions);
97
+ $.jqplot.postDrawHooks.push($.jqplot.Dragable.postPlotDraw);
98
+ $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
99
+ $.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleDown]);
100
+ $.jqplot.eventListenerHooks.push(['jqplotMouseUp', handleUp]);
101
+
102
+
103
+ function initDragPoint(plot, neighbor) {
104
+ var s = plot.series[neighbor.seriesIndex];
105
+ var drag = s.plugins.dragable;
106
+
107
+ // first, init the mark renderer for the dragged point
108
+ var smr = s.markerRenderer;
109
+ var mr = drag.markerRenderer;
110
+ mr.style = smr.style;
111
+ mr.lineWidth = smr.lineWidth + 2.5;
112
+ mr.size = smr.size + 5;
113
+ if (!drag.color) {
114
+ var rgba = $.jqplot.getColorComponents(smr.color);
115
+ var newrgb = [rgba[0], rgba[1], rgba[2]];
116
+ var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
117
+ drag.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
118
+ }
119
+ mr.color = drag.color;
120
+ mr.init();
121
+
122
+ var start = (neighbor.pointIndex > 0) ? neighbor.pointIndex - 1 : 0;
123
+ var end = neighbor.pointIndex+2;
124
+ drag._gridData = s.gridData.slice(start, end);
125
+ }
126
+
127
+ function handleMove(ev, gridpos, datapos, neighbor, plot) {
128
+ if (plot.plugins.dragable.dragCanvas.isDragging) {
129
+ var dc = plot.plugins.dragable.dragCanvas;
130
+ var dp = dc._neighbor;
131
+ var s = plot.series[dp.seriesIndex];
132
+ var drag = s.plugins.dragable;
133
+ var gd = s.gridData;
134
+
135
+ // compute the new grid position with any constraints.
136
+ var x = (drag.constrainTo == 'y') ? dp.gridData[0] : gridpos.x;
137
+ var y = (drag.constrainTo == 'x') ? dp.gridData[1] : gridpos.y;
138
+
139
+ // compute data values for any listeners.
140
+ var xu = s._xaxis.series_p2u(x);
141
+ var yu = s._yaxis.series_p2u(y);
142
+
143
+ // clear the canvas then redraw effect at new position.
144
+ var ctx = dc._ctx;
145
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
146
+
147
+ // adjust our gridData for the new mouse position
148
+ if (dp.pointIndex > 0) {
149
+ drag._gridData[1] = [x, y];
150
+ }
151
+ else {
152
+ drag._gridData[0] = [x, y];
153
+ }
154
+ plot.series[dp.seriesIndex].draw(dc._ctx, {gridData:drag._gridData, shadow:false, preventJqPlotSeriesDrawTrigger:true, color:drag.color, markerOptions:{color:drag.color, shadow:false}, trendline:{show:false}});
155
+ plot.target.trigger('jqplotSeriesPointChange', [dp.seriesIndex, dp.pointIndex, [xu,yu], [x,y]]);
156
+ }
157
+ else if (neighbor != null) {
158
+ var series = plot.series[neighbor.seriesIndex];
159
+ if (series.isDragable) {
160
+ var dc = plot.plugins.dragable.dragCanvas;
161
+ if (!dc.isOver) {
162
+ dc._cursors.push(ev.target.style.cursor);
163
+ ev.target.style.cursor = "pointer";
164
+ }
165
+ dc.isOver = true;
166
+ }
167
+ }
168
+ else if (neighbor == null) {
169
+ var dc = plot.plugins.dragable.dragCanvas;
170
+ if (dc.isOver) {
171
+ ev.target.style.cursor = dc._cursors.pop();
172
+ dc.isOver = false;
173
+ }
174
+ }
175
+ }
176
+
177
+ function handleDown(ev, gridpos, datapos, neighbor, plot) {
178
+ var dc = plot.plugins.dragable.dragCanvas;
179
+ dc._cursors.push(ev.target.style.cursor);
180
+ if (neighbor != null) {
181
+ var s = plot.series[neighbor.seriesIndex];
182
+ var drag = s.plugins.dragable;
183
+ if (s.isDragable && !dc.isDragging) {
184
+ dc._neighbor = neighbor;
185
+ dc.isDragging = true;
186
+ initDragPoint(plot, neighbor);
187
+ drag.markerRenderer.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], dc._ctx);
188
+ ev.target.style.cursor = "move";
189
+ plot.target.trigger('jqplotDragStart', [neighbor.seriesIndex, neighbor.pointIndex, gridpos, datapos]);
190
+ }
191
+ }
192
+ // Just in case of a hickup, we'll clear the drag canvas and reset.
193
+ else {
194
+ var ctx = dc._ctx;
195
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
196
+ dc.isDragging = false;
197
+ }
198
+ }
199
+
200
+ function handleUp(ev, gridpos, datapos, neighbor, plot) {
201
+ if (plot.plugins.dragable.dragCanvas.isDragging) {
202
+ var dc = plot.plugins.dragable.dragCanvas;
203
+ // clear the canvas
204
+ var ctx = dc._ctx;
205
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
206
+ dc.isDragging = false;
207
+ // redraw the series canvas at the new point.
208
+ var dp = dc._neighbor;
209
+ var s = plot.series[dp.seriesIndex];
210
+ var drag = s.plugins.dragable;
211
+ // compute the new grid position with any constraints.
212
+ var x = (drag.constrainTo == 'y') ? dp.data[0] : datapos[s.xaxis];
213
+ var y = (drag.constrainTo == 'x') ? dp.data[1] : datapos[s.yaxis];
214
+ // var x = datapos[s.xaxis];
215
+ // var y = datapos[s.yaxis];
216
+ s.data[dp.pointIndex][0] = x;
217
+ s.data[dp.pointIndex][1] = y;
218
+ plot.drawSeries({preventJqPlotSeriesDrawTrigger:true}, dp.seriesIndex);
219
+ dc._neighbor = null;
220
+ ev.target.style.cursor = dc._cursors.pop();
221
+ plot.target.trigger('jqplotDragStop', [gridpos, datapos]);
222
+ }
223
+ }
224
224
  })(jQuery);