jquery_cheats 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/README.md +1 -0
  2. data/app/assets/javascripts/jquery_cheats/jquery_cheats.js +1 -1
  3. data/app/assets/javascripts/jquery_cheats/replacementContextMenu.js +62 -0
  4. data/jquery_cheats.gemspec +2 -2
  5. data/lib/jquery_cheats/jquery_cheats.rb +58 -0
  6. data/vendor/assets/javascripts/jqplot/excanvas.js +1438 -0
  7. data/vendor/assets/javascripts/jqplot/jquery.jqplot.js +10901 -0
  8. data/vendor/assets/javascripts/jqplot/plugins/jqplot.BezierCurveRenderer.js +312 -0
  9. data/vendor/assets/javascripts/jqplot/plugins/jqplot.BezierCurveRenderer.min.js +57 -0
  10. data/vendor/assets/javascripts/jqplot/plugins/jqplot.barRenderer.js +747 -0
  11. data/vendor/assets/javascripts/jqplot/plugins/jqplot.barRenderer.min.js +57 -0
  12. data/vendor/assets/javascripts/jqplot/plugins/jqplot.blockRenderer.js +234 -0
  13. data/vendor/assets/javascripts/jqplot/plugins/jqplot.blockRenderer.min.js +57 -0
  14. data/vendor/assets/javascripts/jqplot/plugins/jqplot.bubbleRenderer.js +754 -0
  15. data/vendor/assets/javascripts/jqplot/plugins/jqplot.bubbleRenderer.min.js +57 -0
  16. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js +202 -0
  17. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js +57 -0
  18. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisTickRenderer.js +242 -0
  19. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js +57 -0
  20. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasOverlay.js +864 -0
  21. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasOverlay.min.js +57 -0
  22. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasTextRenderer.js +448 -0
  23. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasTextRenderer.min.js +57 -0
  24. data/vendor/assets/javascripts/jqplot/plugins/jqplot.categoryAxisRenderer.js +636 -0
  25. data/vendor/assets/javascripts/jqplot/plugins/jqplot.categoryAxisRenderer.min.js +57 -0
  26. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ciParser.js +115 -0
  27. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ciParser.min.js +57 -0
  28. data/vendor/assets/javascripts/jqplot/plugins/jqplot.cursor.js +1093 -0
  29. data/vendor/assets/javascripts/jqplot/plugins/jqplot.cursor.min.js +57 -0
  30. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dateAxisRenderer.js +702 -0
  31. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dateAxisRenderer.min.js +57 -0
  32. data/vendor/assets/javascripts/jqplot/plugins/jqplot.donutRenderer.js +800 -0
  33. data/vendor/assets/javascripts/jqplot/plugins/jqplot.donutRenderer.min.js +57 -0
  34. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dragable.js +224 -0
  35. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dragable.min.js +57 -0
  36. data/vendor/assets/javascripts/jqplot/plugins/jqplot.enhancedLegendRenderer.js +241 -0
  37. data/vendor/assets/javascripts/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js +57 -0
  38. data/vendor/assets/javascripts/jqplot/plugins/jqplot.funnelRenderer.js +938 -0
  39. data/vendor/assets/javascripts/jqplot/plugins/jqplot.funnelRenderer.min.js +57 -0
  40. data/vendor/assets/javascripts/jqplot/plugins/jqplot.highlighter.js +454 -0
  41. data/vendor/assets/javascripts/jqplot/plugins/jqplot.highlighter.min.js +57 -0
  42. data/vendor/assets/javascripts/jqplot/plugins/jqplot.json2.js +475 -0
  43. data/vendor/assets/javascripts/jqplot/plugins/jqplot.json2.min.js +57 -0
  44. data/vendor/assets/javascripts/jqplot/plugins/jqplot.logAxisRenderer.js +528 -0
  45. data/vendor/assets/javascripts/jqplot/plugins/jqplot.logAxisRenderer.min.js +57 -0
  46. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoAxisRenderer.js +610 -0
  47. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js +57 -0
  48. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoRenderer.js +436 -0
  49. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoRenderer.min.js +57 -0
  50. data/vendor/assets/javascripts/jqplot/plugins/jqplot.meterGaugeRenderer.js +1029 -0
  51. data/vendor/assets/javascripts/jqplot/plugins/jqplot.meterGaugeRenderer.min.js +57 -0
  52. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ohlcRenderer.js +372 -0
  53. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ohlcRenderer.min.js +57 -0
  54. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pieRenderer.js +899 -0
  55. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pieRenderer.min.js +57 -0
  56. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pointLabels.js +362 -0
  57. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pointLabels.min.js +57 -0
  58. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidAxisRenderer.js +730 -0
  59. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js +57 -0
  60. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidGridRenderer.js +423 -0
  61. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidGridRenderer.min.js +57 -0
  62. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidRenderer.js +490 -0
  63. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidRenderer.min.js +57 -0
  64. data/vendor/assets/javascripts/jqplot/plugins/jqplot.trendline.js +222 -0
  65. data/vendor/assets/javascripts/jqplot/plugins/jqplot.trendline.min.js +57 -0
  66. data/vendor/assets/javascripts/jquery_cheats/spinjs/spin.min.js +1 -1
  67. data/vendor/assets/stylesheets/jquery.jqplot.css +259 -0
  68. metadata +66 -3
@@ -0,0 +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
+ */
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);
@@ -0,0 +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
+
234
+
@@ -0,0 +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
+ */
57
+ (function(a){a.jqplot.BlockRenderer=function(){a.jqplot.LineRenderer.call(this)};a.jqplot.BlockRenderer.prototype=new a.jqplot.LineRenderer();a.jqplot.BlockRenderer.prototype.constructor=a.jqplot.BlockRenderer;a.jqplot.BlockRenderer.prototype.init=function(b){this.css={padding:"2px",border:"1px solid #999",textAlign:"center"};this.escapeHtml=false;this.insertBreaks=true;this.varyBlockColors=false;a.extend(true,this,b);if(this.css.backgroundColor){this.color=this.css.backgroundColor}else{if(this.css.background){this.color=this.css.background}else{if(!this.varyBlockColors){this.css.background=this.color}}}this.canvas=new a.jqplot.BlockCanvas();this.shadowCanvas=new a.jqplot.BlockCanvas();this.canvas._plotDimensions=this._plotDimensions;this.shadowCanvas._plotDimensions=this._plotDimensions;this._type="block";this.moveBlock=function(l,j,i,e){var c=this.canvas._elem.children(":eq("+l+")");this.data[l][0]=j;this.data[l][1]=i;this._plotData[l][0]=j;this._plotData[l][1]=i;this._stackData[l][0]=j;this._stackData[l][1]=i;this.gridData[l][0]=this._xaxis.series_u2p(j);this.gridData[l][1]=this._yaxis.series_u2p(i);var k=c.outerWidth();var f=c.outerHeight();var d=this.gridData[l][0]-k/2+"px";var g=this.gridData[l][1]-f/2+"px";if(e){if(parseInt(e,10)){e=parseInt(e,10)}c.animate({left:d,top:g},e)}else{c.css({left:d,top:g})}c=null}};a.jqplot.BlockRenderer.prototype.draw=function(q,o,r){if(this.plugins.pointLabels){this.plugins.pointLabels.show=false}var f,c,l,o,p,k,n,g,e,m;var b=(r!=undefined)?r:{};var j=new a.jqplot.ColorGenerator(this.seriesColors);this.canvas._elem.empty();for(f=0;f<this.gridData.length;f++){l=this.data[f];o=this.gridData[f];p="";k={};if(typeof l[2]=="string"){p=l[2]}else{if(typeof l[2]=="object"){k=l[2]}}if(typeof l[3]=="object"){k=l[3]}if(this.insertBreaks){p=p.replace(/ /g,"<br />")}k=a.extend(true,{},this.css,k);c=a('<div style="position:absolute;margin-left:auto;margin-right:auto;"></div>');this.canvas._elem.append(c);this.escapeHtml?c.text(p):c.html(p);delete k.position;delete k.marginRight;delete k.marginLeft;if(!k.background&&!k.backgroundColor&&!k.backgroundImage){k.background=j.next()}c.css(k);n=c.outerWidth();g=c.outerHeight();e=o[0]-n/2+"px";m=o[1]-g/2+"px";c.css({left:e,top:m});c=null}};a.jqplot.BlockCanvas=function(){a.jqplot.ElemContainer.call(this);this._ctx};a.jqplot.BlockCanvas.prototype=new a.jqplot.ElemContainer();a.jqplot.BlockCanvas.prototype.constructor=a.jqplot.BlockCanvas;a.jqplot.BlockCanvas.prototype.createElement=function(i,e,c){this._offsets=i;var b="jqplot-blockCanvas";if(e!=undefined){b=e}var g;if(this._elem){g=this._elem.get(0)}else{g=document.createElement("div")}if(c!=undefined){this._plotDimensions=c}var d=this._plotDimensions.width-this._offsets.left-this._offsets.right+"px";var f=this._plotDimensions.height-this._offsets.top-this._offsets.bottom+"px";this._elem=a(g);this._elem.css({position:"absolute",width:d,height:f,left:this._offsets.left,top:this._offsets.top});this._elem.addClass(b);return this._elem};a.jqplot.BlockCanvas.prototype.setContext=function(){this._ctx={canvas:{width:0,height:0},clearRect:function(){return null}};return this._ctx}})(jQuery);
@@ -0,0 +1,754 @@
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
+ var arrayMax = function( array ){
32
+ return Math.max.apply( Math, array );
33
+ };
34
+ var arrayMin = function( array ){
35
+ return Math.min.apply( Math, array );
36
+ };
37
+
38
+ /**
39
+ * Class: $.jqplot.BubbleRenderer
40
+ * Plugin renderer to draw a bubble chart. A Bubble chart has data points displayed as
41
+ * colored circles with an optional text label inside. To use
42
+ * the bubble renderer, you must include the bubble renderer like:
43
+ *
44
+ * > <script language="javascript" type="text/javascript" src="../src/plugins/jqplot.bubbleRenderer.js"></script>
45
+ *
46
+ * Data must be supplied in
47
+ * the form:
48
+ *
49
+ * > [[x1, y1, r1, <label or {label:'text', color:color}>], ...]
50
+ *
51
+ * where the label or options
52
+ * object is optional.
53
+ *
54
+ * Note that all bubble colors will be the same
55
+ * unless the "varyBubbleColors" option is set to true. Colors can be specified in the data array
56
+ * or in the seriesColors array option on the series. If no colors are defined, the default jqPlot
57
+ * series of 16 colors are used. Colors are automatically cycled around again if there are more
58
+ * bubbles than colors.
59
+ *
60
+ * Bubbles are autoscaled by default to fit within the chart area while maintaining
61
+ * relative sizes. If the "autoscaleBubbles" option is set to false, the r(adius) values
62
+ * in the data array a treated as literal pixel values for the radii of the bubbles.
63
+ *
64
+ * Properties are passed into the bubble renderer in the rendererOptions object of
65
+ * the series options like:
66
+ *
67
+ * > seriesDefaults: {
68
+ * > renderer: $.jqplot.BubbleRenderer,
69
+ * > rendererOptions: {
70
+ * > bubbleAlpha: 0.7,
71
+ * > varyBubbleColors: false
72
+ * > }
73
+ * > }
74
+ *
75
+ */
76
+ $.jqplot.BubbleRenderer = function(){
77
+ $.jqplot.LineRenderer.call(this);
78
+ };
79
+
80
+ $.jqplot.BubbleRenderer.prototype = new $.jqplot.LineRenderer();
81
+ $.jqplot.BubbleRenderer.prototype.constructor = $.jqplot.BubbleRenderer;
82
+
83
+ // called with scope of a series
84
+ $.jqplot.BubbleRenderer.prototype.init = function(options, plot) {
85
+ // Group: Properties
86
+ //
87
+ // prop: varyBubbleColors
88
+ // True to vary the color of each bubble in this series according to
89
+ // the seriesColors array. False to set each bubble to the color
90
+ // specified on this series. This has no effect if a css background color
91
+ // option is specified in the renderer css options.
92
+ this.varyBubbleColors = true;
93
+ // prop: autoscaleBubbles
94
+ // True to scale the bubble radius based on plot size.
95
+ // False will use the radius value as provided as a raw pixel value for
96
+ // bubble radius.
97
+ this.autoscaleBubbles = true;
98
+ // prop: autoscaleMultiplier
99
+ // Multiplier the bubble size if autoscaleBubbles is true.
100
+ this.autoscaleMultiplier = 1.0;
101
+ // prop: autoscalePointsFactor
102
+ // Factor which decreases bubble size based on how many bubbles on on the chart.
103
+ // 0 means no adjustment for number of bubbles. Negative values will decrease
104
+ // size of bubbles as more bubbles are added. Values between 0 and -0.2
105
+ // should work well.
106
+ this.autoscalePointsFactor = -0.07;
107
+ // prop: escapeHtml
108
+ // True to escape html in bubble label text.
109
+ this.escapeHtml = true;
110
+ // prop: highlightMouseOver
111
+ // True to highlight bubbles when moused over.
112
+ // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
113
+ this.highlightMouseOver = true;
114
+ // prop: highlightMouseDown
115
+ // True to highlight when a mouse button is pressed over a bubble.
116
+ // This will be disabled if highlightMouseOver is true.
117
+ this.highlightMouseDown = false;
118
+ // prop: highlightColors
119
+ // An array of colors to use when highlighting a slice. Calculated automatically
120
+ // if not supplied.
121
+ this.highlightColors = [];
122
+ // prop: bubbleAlpha
123
+ // Alpha transparency to apply to all bubbles in this series.
124
+ this.bubbleAlpha = 1.0;
125
+ // prop: highlightAlpha
126
+ // Alpha transparency to apply when highlighting bubble.
127
+ // Set to value of bubbleAlpha by default.
128
+ this.highlightAlpha = null;
129
+ // prop: bubbleGradients
130
+ // True to color the bubbles with gradient fills instead of flat colors.
131
+ // NOT AVAILABLE IN IE due to lack of excanvas support for radial gradient fills.
132
+ // will be ignored in IE.
133
+ this.bubbleGradients = false;
134
+ // prop: showLabels
135
+ // True to show labels on bubbles (if any), false to not show.
136
+ this.showLabels = true;
137
+ // array of [point index, radius] which will be sorted in descending order to plot
138
+ // largest points below smaller points.
139
+ this.radii = [];
140
+ this.maxRadius = 0;
141
+ // index of the currenty highlighted point, if any
142
+ this._highlightedPoint = null;
143
+ // array of jQuery labels.
144
+ this.labels = [];
145
+ this.bubbleCanvases = [];
146
+ this._type = 'bubble';
147
+
148
+ // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
149
+ if (options.highlightMouseDown && options.highlightMouseOver == null) {
150
+ options.highlightMouseOver = false;
151
+ }
152
+
153
+ $.extend(true, this, options);
154
+
155
+ if (this.highlightAlpha == null) {
156
+ this.highlightAlpha = this.bubbleAlpha;
157
+ if (this.bubbleGradients) {
158
+ this.highlightAlpha = 0.35;
159
+ }
160
+ }
161
+
162
+ this.autoscaleMultiplier = this.autoscaleMultiplier * Math.pow(this.data.length, this.autoscalePointsFactor);
163
+
164
+ // index of the currenty highlighted point, if any
165
+ this._highlightedPoint = null;
166
+
167
+ // adjust the series colors for options colors passed in with data or for alpha.
168
+ // note, this can leave undefined holes in the seriesColors array.
169
+ var comps;
170
+ for (var i=0; i<this.data.length; i++) {
171
+ var color = null;
172
+ var d = this.data[i];
173
+ this.maxRadius = Math.max(this.maxRadius, d[2]);
174
+ if (d[3]) {
175
+ if (typeof(d[3]) == 'object') {
176
+ color = d[3]['color'];
177
+ }
178
+ }
179
+
180
+ if (color == null) {
181
+ if (this.seriesColors[i] != null) {
182
+ color = this.seriesColors[i];
183
+ }
184
+ }
185
+
186
+ if (color && this.bubbleAlpha < 1.0) {
187
+ comps = $.jqplot.getColorComponents(color);
188
+ color = 'rgba('+comps[0]+', '+comps[1]+', '+comps[2]+', '+this.bubbleAlpha+')';
189
+ }
190
+
191
+ if (color) {
192
+ this.seriesColors[i] = color;
193
+ }
194
+ }
195
+
196
+ if (!this.varyBubbleColors) {
197
+ this.seriesColors = [this.color];
198
+ }
199
+
200
+ this.colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
201
+
202
+ // set highlight colors if none provided
203
+ if (this.highlightColors.length == 0) {
204
+ for (var i=0; i<this.seriesColors.length; i++){
205
+ var rgba = $.jqplot.getColorComponents(this.seriesColors[i]);
206
+ var newrgb = [rgba[0], rgba[1], rgba[2]];
207
+ var sum = newrgb[0] + newrgb[1] + newrgb[2];
208
+ for (var j=0; j<3; j++) {
209
+ // when darkening, lowest color component can be is 60.
210
+ newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
211
+ newrgb[j] = parseInt(newrgb[j], 10);
212
+ }
213
+ this.highlightColors.push('rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+', '+this.highlightAlpha+')');
214
+ }
215
+ }
216
+
217
+ this.highlightColorGenerator = new $.jqplot.ColorGenerator(this.highlightColors);
218
+
219
+ var sopts = {fill:true, isarc:true, angle:this.shadowAngle, alpha:this.shadowAlpha, closePath:true};
220
+
221
+ this.renderer.shadowRenderer.init(sopts);
222
+
223
+ this.canvas = new $.jqplot.DivCanvas();
224
+ this.canvas._plotDimensions = this._plotDimensions;
225
+
226
+ plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
227
+ plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
228
+ plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
229
+ plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
230
+ plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
231
+ plot.postDrawHooks.addOnce(postPlotDraw);
232
+
233
+ };
234
+
235
+
236
+ // converts the user data values to grid coordinates and stores them
237
+ // in the gridData array.
238
+ // Called with scope of a series.
239
+ $.jqplot.BubbleRenderer.prototype.setGridData = function(plot) {
240
+ // recalculate the grid data
241
+ var xp = this._xaxis.series_u2p;
242
+ var yp = this._yaxis.series_u2p;
243
+ var data = this._plotData;
244
+ this.gridData = [];
245
+ var radii = [];
246
+ this.radii = [];
247
+ var dim = Math.min(plot._height, plot._width);
248
+ for (var i=0; i<this.data.length; i++) {
249
+ if (data[i] != null) {
250
+ this.gridData.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1]), data[i][2]]);
251
+ this.radii.push([i, data[i][2]]);
252
+ radii.push(data[i][2]);
253
+ }
254
+ }
255
+ var r, val, maxr = this.maxRadius = arrayMax(radii);
256
+ var l = this.gridData.length;
257
+ if (this.autoscaleBubbles) {
258
+ for (var i=0; i<l; i++) {
259
+ val = radii[i]/maxr;
260
+ r = this.autoscaleMultiplier * dim / 6;
261
+ this.gridData[i][2] = r * val;
262
+ }
263
+ }
264
+
265
+ this.radii.sort(function(a, b) { return b[1] - a[1]; });
266
+ };
267
+
268
+ // converts any arbitrary data values to grid coordinates and
269
+ // returns them. This method exists so that plugins can use a series'
270
+ // linerenderer to generate grid data points without overwriting the
271
+ // grid data associated with that series.
272
+ // Called with scope of a series.
273
+ $.jqplot.BubbleRenderer.prototype.makeGridData = function(data, plot) {
274
+ // recalculate the grid data
275
+ var xp = this._xaxis.series_u2p;
276
+ var yp = this._yaxis.series_u2p;
277
+ var gd = [];
278
+ var radii = [];
279
+ this.radii = [];
280
+ var dim = Math.min(plot._height, plot._width);
281
+ for (var i=0; i<data.length; i++) {
282
+ if (data[i] != null) {
283
+ gd.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1]), data[i][2]]);
284
+ radii.push(data[i][2]);
285
+ this.radii.push([i, data[i][2]]);
286
+ }
287
+ }
288
+ var r, val, maxr = this.maxRadius = arrayMax(radii);
289
+ var l = this.gridData.length;
290
+ if (this.autoscaleBubbles) {
291
+ for (var i=0; i<l; i++) {
292
+ val = radii[i]/maxr;
293
+ r = this.autoscaleMultiplier * dim / 6;
294
+ gd[i][2] = r * val;
295
+ }
296
+ }
297
+ this.radii.sort(function(a, b) { return b[1] - a[1]; });
298
+ return gd;
299
+ };
300
+
301
+ // called with scope of series
302
+ $.jqplot.BubbleRenderer.prototype.draw = function (ctx, gd, options) {
303
+ if (this.plugins.pointLabels) {
304
+ this.plugins.pointLabels.show = false;
305
+ }
306
+ var opts = (options != undefined) ? options : {};
307
+ var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
308
+ this.canvas._elem.empty();
309
+ for (var i=0; i<this.radii.length; i++) {
310
+ var idx = this.radii[i][0];
311
+ var t=null;
312
+ var color = null;
313
+ var el = null;
314
+ var tel = null;
315
+ var d = this.data[idx];
316
+ var gd = this.gridData[idx];
317
+ if (d[3]) {
318
+ if (typeof(d[3]) == 'object') {
319
+ t = d[3]['label'];
320
+ }
321
+ else if (typeof(d[3]) == 'string') {
322
+ t = d[3];
323
+ }
324
+ }
325
+
326
+ // color = (this.varyBubbleColors) ? this.colorGenerator.get(idx) : this.color;
327
+ color = this.colorGenerator.get(idx);
328
+
329
+ // If we're drawing a shadow, expand the canvas dimensions to accomodate.
330
+ var canvasRadius = gd[2];
331
+ var offset, depth;
332
+ if (this.shadow) {
333
+ offset = (0.7 + gd[2]/40).toFixed(1);
334
+ depth = 1 + Math.ceil(gd[2]/15);
335
+ canvasRadius += offset*depth;
336
+ }
337
+ this.bubbleCanvases[idx] = new $.jqplot.BubbleCanvas();
338
+ this.canvas._elem.append(this.bubbleCanvases[idx].createElement(gd[0], gd[1], canvasRadius));
339
+ this.bubbleCanvases[idx].setContext();
340
+ var ctx = this.bubbleCanvases[idx]._ctx;
341
+ var x = ctx.canvas.width/2;
342
+ var y = ctx.canvas.height/2;
343
+ if (this.shadow) {
344
+ this.renderer.shadowRenderer.draw(ctx, [x, y, gd[2], 0, 2*Math.PI], {offset: offset, depth: depth});
345
+ }
346
+ this.bubbleCanvases[idx].draw(gd[2], color, this.bubbleGradients, this.shadowAngle/180*Math.PI);
347
+
348
+ // now draw label.
349
+ if (t && this.showLabels) {
350
+ tel = $('<div style="position:absolute;" class="jqplot-bubble-label"></div>');
351
+ if (this.escapeHtml) {
352
+ tel.text(t);
353
+ }
354
+ else {
355
+ tel.html(t);
356
+ }
357
+ this.canvas._elem.append(tel);
358
+ var h = $(tel).outerHeight();
359
+ var w = $(tel).outerWidth();
360
+ var top = gd[1] - 0.5*h;
361
+ var left = gd[0] - 0.5*w;
362
+ tel.css({top: top, left: left});
363
+ this.labels[idx] = $(tel);
364
+ }
365
+ }
366
+ };
367
+
368
+
369
+ $.jqplot.DivCanvas = function() {
370
+ $.jqplot.ElemContainer.call(this);
371
+ this._ctx;
372
+ };
373
+
374
+ $.jqplot.DivCanvas.prototype = new $.jqplot.ElemContainer();
375
+ $.jqplot.DivCanvas.prototype.constructor = $.jqplot.DivCanvas;
376
+
377
+ $.jqplot.DivCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
378
+ this._offsets = offsets;
379
+ var klass = 'jqplot-DivCanvas';
380
+ if (clss != undefined) {
381
+ klass = clss;
382
+ }
383
+ var elem;
384
+ // if this canvas already has a dom element, don't make a new one.
385
+ if (this._elem) {
386
+ elem = this._elem.get(0);
387
+ }
388
+ else {
389
+ elem = document.createElement('div');
390
+ }
391
+ // if new plotDimensions supplied, use them.
392
+ if (plotDimensions != undefined) {
393
+ this._plotDimensions = plotDimensions;
394
+ }
395
+
396
+ var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
397
+ var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
398
+ this._elem = $(elem);
399
+ this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
400
+
401
+ this._elem.addClass(klass);
402
+ return this._elem;
403
+ };
404
+
405
+ $.jqplot.DivCanvas.prototype.setContext = function() {
406
+ this._ctx = {
407
+ canvas:{
408
+ width:0,
409
+ height:0
410
+ },
411
+ clearRect:function(){return null;}
412
+ };
413
+ return this._ctx;
414
+ };
415
+
416
+ $.jqplot.BubbleCanvas = function() {
417
+ $.jqplot.ElemContainer.call(this);
418
+ this._ctx;
419
+ };
420
+
421
+ $.jqplot.BubbleCanvas.prototype = new $.jqplot.ElemContainer();
422
+ $.jqplot.BubbleCanvas.prototype.constructor = $.jqplot.BubbleCanvas;
423
+
424
+ // initialize with the x,y pont of bubble center and the bubble radius.
425
+ $.jqplot.BubbleCanvas.prototype.createElement = function(x, y, r) {
426
+ var klass = 'jqplot-bubble-point';
427
+
428
+ var elem;
429
+ // if this canvas already has a dom element, don't make a new one.
430
+ if (this._elem) {
431
+ elem = this._elem.get(0);
432
+ }
433
+ else {
434
+ elem = document.createElement('canvas');
435
+ }
436
+
437
+ elem.width = (r != null) ? 2*r : elem.width;
438
+ elem.height = (r != null) ? 2*r : elem.height;
439
+ this._elem = $(elem);
440
+ var l = (x != null && r != null) ? x - r : this._elem.css('left');
441
+ var t = (y != null && r != null) ? y - r : this._elem.css('top');
442
+ this._elem.css({ position: 'absolute', left: l, top: t });
443
+
444
+ this._elem.addClass(klass);
445
+ if ($.jqplot.use_excanvas) {
446
+ window.G_vmlCanvasManager.init_(document);
447
+ elem = window.G_vmlCanvasManager.initElement(elem);
448
+ }
449
+
450
+ return this._elem;
451
+ };
452
+
453
+ $.jqplot.BubbleCanvas.prototype.draw = function(r, color, gradients, angle) {
454
+ var ctx = this._ctx;
455
+ // r = Math.floor(r*1.04);
456
+ // var x = Math.round(ctx.canvas.width/2);
457
+ // var y = Math.round(ctx.canvas.height/2);
458
+ var x = ctx.canvas.width/2;
459
+ var y = ctx.canvas.height/2;
460
+ ctx.save();
461
+ if (gradients && !$.jqplot.use_excanvas) {
462
+ r = r*1.04;
463
+ var comps = $.jqplot.getColorComponents(color);
464
+ var colorinner = 'rgba('+Math.round(comps[0]+0.8*(255-comps[0]))+', '+Math.round(comps[1]+0.8*(255-comps[1]))+', '+Math.round(comps[2]+0.8*(255-comps[2]))+', '+comps[3]+')';
465
+ var colorend = 'rgba('+comps[0]+', '+comps[1]+', '+comps[2]+', 0)';
466
+ // var rinner = Math.round(0.35 * r);
467
+ // var xinner = Math.round(x - Math.cos(angle) * 0.33 * r);
468
+ // var yinner = Math.round(y - Math.sin(angle) * 0.33 * r);
469
+ var rinner = 0.35 * r;
470
+ var xinner = x - Math.cos(angle) * 0.33 * r;
471
+ var yinner = y - Math.sin(angle) * 0.33 * r;
472
+ var radgrad = ctx.createRadialGradient(xinner, yinner, rinner, x, y, r);
473
+ radgrad.addColorStop(0, colorinner);
474
+ radgrad.addColorStop(0.93, color);
475
+ radgrad.addColorStop(0.96, colorend);
476
+ radgrad.addColorStop(1, colorend);
477
+ // radgrad.addColorStop(.98, colorend);
478
+ ctx.fillStyle = radgrad;
479
+ ctx.fillRect(0,0, ctx.canvas.width, ctx.canvas.height);
480
+ }
481
+ else {
482
+ ctx.fillStyle = color;
483
+ ctx.strokeStyle = color;
484
+ ctx.lineWidth = 1;
485
+ ctx.beginPath();
486
+ var ang = 2*Math.PI;
487
+ ctx.arc(x, y, r, 0, ang, 0);
488
+ ctx.closePath();
489
+ ctx.fill();
490
+ }
491
+ ctx.restore();
492
+ };
493
+
494
+ $.jqplot.BubbleCanvas.prototype.setContext = function() {
495
+ this._ctx = this._elem.get(0).getContext("2d");
496
+ return this._ctx;
497
+ };
498
+
499
+ $.jqplot.BubbleAxisRenderer = function() {
500
+ $.jqplot.LinearAxisRenderer.call(this);
501
+ };
502
+
503
+ $.jqplot.BubbleAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
504
+ $.jqplot.BubbleAxisRenderer.prototype.constructor = $.jqplot.BubbleAxisRenderer;
505
+
506
+ // called with scope of axis object.
507
+ $.jqplot.BubbleAxisRenderer.prototype.init = function(options){
508
+ $.extend(true, this, options);
509
+ var db = this._dataBounds;
510
+ var minsidx = 0,
511
+ minpidx = 0,
512
+ maxsidx = 0,
513
+ maxpidx = 0,
514
+ maxr = 0,
515
+ minr = 0,
516
+ minMaxRadius = 0,
517
+ maxMaxRadius = 0,
518
+ maxMult = 0,
519
+ minMult = 0;
520
+ // Go through all the series attached to this axis and find
521
+ // the min/max bounds for this axis.
522
+ for (var i=0; i<this._series.length; i++) {
523
+ var s = this._series[i];
524
+ var d = s._plotData;
525
+
526
+ for (var j=0; j<d.length; j++) {
527
+ if (this.name == 'xaxis' || this.name == 'x2axis') {
528
+ if (d[j][0] < db.min || db.min == null) {
529
+ db.min = d[j][0];
530
+ minsidx=i;
531
+ minpidx=j;
532
+ minr = d[j][2];
533
+ minMaxRadius = s.maxRadius;
534
+ minMult = s.autoscaleMultiplier;
535
+ }
536
+ if (d[j][0] > db.max || db.max == null) {
537
+ db.max = d[j][0];
538
+ maxsidx=i;
539
+ maxpidx=j;
540
+ maxr = d[j][2];
541
+ maxMaxRadius = s.maxRadius;
542
+ maxMult = s.autoscaleMultiplier;
543
+ }
544
+ }
545
+ else {
546
+ if (d[j][1] < db.min || db.min == null) {
547
+ db.min = d[j][1];
548
+ minsidx=i;
549
+ minpidx=j;
550
+ minr = d[j][2];
551
+ minMaxRadius = s.maxRadius;
552
+ minMult = s.autoscaleMultiplier;
553
+ }
554
+ if (d[j][1] > db.max || db.max == null) {
555
+ db.max = d[j][1];
556
+ maxsidx=i;
557
+ maxpidx=j;
558
+ maxr = d[j][2];
559
+ maxMaxRadius = s.maxRadius;
560
+ maxMult = s.autoscaleMultiplier;
561
+ }
562
+ }
563
+ }
564
+ }
565
+
566
+ var minRatio = minr/minMaxRadius;
567
+ var maxRatio = maxr/maxMaxRadius;
568
+
569
+ // need to estimate the effect of the radius on total axis span and adjust axis accordingly.
570
+ var span = db.max - db.min;
571
+ // var dim = (this.name == 'xaxis' || this.name == 'x2axis') ? this._plotDimensions.width : this._plotDimensions.height;
572
+ var dim = Math.min(this._plotDimensions.width, this._plotDimensions.height);
573
+
574
+ var minfact = minRatio * minMult/3 * span;
575
+ var maxfact = maxRatio * maxMult/3 * span;
576
+ db.max += maxfact;
577
+ db.min -= minfact;
578
+ };
579
+
580
+ function highlight (plot, sidx, pidx) {
581
+ plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
582
+ var s = plot.series[sidx];
583
+ var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
584
+ var ctx = canvas._ctx;
585
+ ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
586
+ s._highlightedPoint = pidx;
587
+ plot.plugins.bubbleRenderer.highlightedSeriesIndex = sidx;
588
+
589
+ var color = s.highlightColorGenerator.get(pidx);
590
+ var x = s.gridData[pidx][0],
591
+ y = s.gridData[pidx][1],
592
+ r = s.gridData[pidx][2];
593
+ ctx.save();
594
+ ctx.fillStyle = color;
595
+ ctx.strokeStyle = color;
596
+ ctx.lineWidth = 1;
597
+ ctx.beginPath();
598
+ ctx.arc(x, y, r, 0, 2*Math.PI, 0);
599
+ ctx.closePath();
600
+ ctx.fill();
601
+ ctx.restore();
602
+ // bring label to front
603
+ if (s.labels[pidx]) {
604
+ plot.plugins.bubbleRenderer.highlightLabel = s.labels[pidx].clone();
605
+ plot.plugins.bubbleRenderer.highlightLabel.appendTo(plot.plugins.bubbleRenderer.highlightLabelCanvas);
606
+ plot.plugins.bubbleRenderer.highlightLabel.addClass('jqplot-bubble-label-highlight');
607
+ }
608
+ }
609
+
610
+ function unhighlight (plot) {
611
+ var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
612
+ var sidx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
613
+ plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
614
+ canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
615
+ for (var i=0; i<plot.series.length; i++) {
616
+ plot.series[i]._highlightedPoint = null;
617
+ }
618
+ plot.plugins.bubbleRenderer.highlightedSeriesIndex = null;
619
+ plot.target.trigger('jqplotDataUnhighlight');
620
+ }
621
+
622
+
623
+ function handleMove(ev, gridpos, datapos, neighbor, plot) {
624
+ if (neighbor) {
625
+ var si = neighbor.seriesIndex;
626
+ var pi = neighbor.pointIndex;
627
+ var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
628
+ var evt1 = jQuery.Event('jqplotDataMouseOver');
629
+ evt1.pageX = ev.pageX;
630
+ evt1.pageY = ev.pageY;
631
+ plot.target.trigger(evt1, ins);
632
+ if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.bubbleRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
633
+ var evt = jQuery.Event('jqplotDataHighlight');
634
+ evt.pageX = ev.pageX;
635
+ evt.pageY = ev.pageY;
636
+ plot.target.trigger(evt, ins);
637
+ highlight (plot, ins[0], ins[1]);
638
+ }
639
+ }
640
+ else if (neighbor == null) {
641
+ unhighlight (plot);
642
+ }
643
+ }
644
+
645
+ function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
646
+ if (neighbor) {
647
+ var si = neighbor.seriesIndex;
648
+ var pi = neighbor.pointIndex;
649
+ var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
650
+ if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.bubbleRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
651
+ var evt = jQuery.Event('jqplotDataHighlight');
652
+ evt.pageX = ev.pageX;
653
+ evt.pageY = ev.pageY;
654
+ plot.target.trigger(evt, ins);
655
+ highlight (plot, ins[0], ins[1]);
656
+ }
657
+ }
658
+ else if (neighbor == null) {
659
+ unhighlight (plot);
660
+ }
661
+ }
662
+
663
+ function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
664
+ var idx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
665
+ if (idx != null && plot.series[idx].highlightMouseDown) {
666
+ unhighlight(plot);
667
+ }
668
+ }
669
+
670
+ function handleClick(ev, gridpos, datapos, neighbor, plot) {
671
+ if (neighbor) {
672
+ var si = neighbor.seriesIndex;
673
+ var pi = neighbor.pointIndex;
674
+ var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
675
+ var evt = jQuery.Event('jqplotDataClick');
676
+ evt.pageX = ev.pageX;
677
+ evt.pageY = ev.pageY;
678
+ plot.target.trigger(evt, ins);
679
+ }
680
+ }
681
+
682
+ function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
683
+ if (neighbor) {
684
+ var si = neighbor.seriesIndex;
685
+ var pi = neighbor.pointIndex;
686
+ var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
687
+ var idx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
688
+ if (idx != null && plot.series[idx].highlightMouseDown) {
689
+ unhighlight(plot);
690
+ }
691
+ var evt = jQuery.Event('jqplotDataRightClick');
692
+ evt.pageX = ev.pageX;
693
+ evt.pageY = ev.pageY;
694
+ plot.target.trigger(evt, ins);
695
+ }
696
+ }
697
+
698
+ // called within context of plot
699
+ // create a canvas which we can draw on.
700
+ // insert it before the eventCanvas, so eventCanvas will still capture events.
701
+ function postPlotDraw() {
702
+ // Memory Leaks patch
703
+ if (this.plugins.bubbleRenderer && this.plugins.bubbleRenderer.highlightCanvas) {
704
+ this.plugins.bubbleRenderer.highlightCanvas.resetCanvas();
705
+ this.plugins.bubbleRenderer.highlightCanvas = null;
706
+ }
707
+
708
+ this.plugins.bubbleRenderer = {highlightedSeriesIndex:null};
709
+ this.plugins.bubbleRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
710
+ this.plugins.bubbleRenderer.highlightLabel = null;
711
+ this.plugins.bubbleRenderer.highlightLabelCanvas = $('<div style="position:absolute;"></div>');
712
+ var top = this._gridPadding.top;
713
+ var left = this._gridPadding.left;
714
+ var width = this._plotDimensions.width - this._gridPadding.left - this._gridPadding.right;
715
+ var height = this._plotDimensions.height - this._gridPadding.top - this._gridPadding.bottom;
716
+ this.plugins.bubbleRenderer.highlightLabelCanvas.css({top:top, left:left, width:width+'px', height:height+'px'});
717
+
718
+ this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-bubbleRenderer-highlight-canvas', this._plotDimensions, this));
719
+ this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightLabelCanvas);
720
+
721
+ var hctx = this.plugins.bubbleRenderer.highlightCanvas.setContext();
722
+ }
723
+
724
+
725
+ // setup default renderers for axes and legend so user doesn't have to
726
+ // called with scope of plot
727
+ function preInit(target, data, options) {
728
+ options = options || {};
729
+ options.axesDefaults = options.axesDefaults || {};
730
+ options.seriesDefaults = options.seriesDefaults || {};
731
+ // only set these if there is a Bubble series
732
+ var setopts = false;
733
+ if (options.seriesDefaults.renderer == $.jqplot.BubbleRenderer) {
734
+ setopts = true;
735
+ }
736
+ else if (options.series) {
737
+ for (var i=0; i < options.series.length; i++) {
738
+ if (options.series[i].renderer == $.jqplot.BubbleRenderer) {
739
+ setopts = true;
740
+ }
741
+ }
742
+ }
743
+
744
+ if (setopts) {
745
+ options.axesDefaults.renderer = $.jqplot.BubbleAxisRenderer;
746
+ options.sortData = false;
747
+ }
748
+ }
749
+
750
+ $.jqplot.preInitHooks.push(preInit);
751
+
752
+ })(jQuery);
753
+
754
+