sunrise-votes 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/Gemfile +5 -0
  2. data/README.rdoc +14 -0
  3. data/Rakefile +46 -0
  4. data/app/controllers/manage/ballot_box/votes_controller.rb +36 -0
  5. data/app/views/manage/ballot_box/votes/_model_filter.html.erb +34 -0
  6. data/app/views/manage/ballot_box/votes/_vote.html.erb +48 -0
  7. data/app/views/manage/ballot_box/votes/index.html.erb +29 -0
  8. data/app/views/manage/ballot_box/votes/show.html.erb +112 -0
  9. data/config/locales/ru.yml +5 -0
  10. data/config/locales/uk.yml +5 -0
  11. data/config/routes.rb +8 -0
  12. data/lib/generators/sunrise/votes/USAGE +5 -0
  13. data/lib/generators/sunrise/votes/install_generator.rb +16 -0
  14. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/excanvas.min.js +35 -0
  15. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/jquery.jqplot.css +226 -0
  16. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/jquery.jqplot.min.js +30 -0
  17. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.BezierCurveRenderer.js +312 -0
  18. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.BezierCurveRenderer.min.js +30 -0
  19. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.barRenderer.js +702 -0
  20. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.barRenderer.min.js +30 -0
  21. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.blockRenderer.js +234 -0
  22. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.blockRenderer.min.js +30 -0
  23. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.bubbleRenderer.js +748 -0
  24. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.bubbleRenderer.min.js +30 -0
  25. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisLabelRenderer.js +199 -0
  26. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisLabelRenderer.min.js +30 -0
  27. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisTickRenderer.js +238 -0
  28. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisTickRenderer.min.js +30 -0
  29. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasOverlay.js +614 -0
  30. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasOverlay.min.js +30 -0
  31. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasTextRenderer.js +420 -0
  32. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasTextRenderer.min.js +30 -0
  33. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.categoryAxisRenderer.js +634 -0
  34. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.categoryAxisRenderer.min.js +30 -0
  35. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ciParser.js +115 -0
  36. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ciParser.min.js +30 -0
  37. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.cursor.js +1002 -0
  38. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.cursor.min.js +30 -0
  39. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dateAxisRenderer.js +439 -0
  40. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dateAxisRenderer.min.js +30 -0
  41. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.donutRenderer.js +904 -0
  42. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.donutRenderer.min.js +30 -0
  43. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dragable.js +218 -0
  44. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dragable.min.js +30 -0
  45. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.enhancedLegendRenderer.js +199 -0
  46. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.enhancedLegendRenderer.min.js +30 -0
  47. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.funnelRenderer.js +932 -0
  48. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.funnelRenderer.min.js +30 -0
  49. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.highlighter.js +406 -0
  50. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.highlighter.min.js +30 -0
  51. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.json2.js +475 -0
  52. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.json2.min.js +30 -0
  53. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.logAxisRenderer.js +446 -0
  54. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.logAxisRenderer.min.js +30 -0
  55. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoAxisRenderer.js +607 -0
  56. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoAxisRenderer.min.js +30 -0
  57. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoRenderer.js +432 -0
  58. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoRenderer.min.js +30 -0
  59. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.meterGaugeRenderer.js +1142 -0
  60. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.meterGaugeRenderer.min.js +30 -0
  61. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ohlcRenderer.js +372 -0
  62. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ohlcRenderer.min.js +30 -0
  63. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pieRenderer.js +797 -0
  64. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pieRenderer.min.js +30 -0
  65. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pointLabels.js +337 -0
  66. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pointLabels.min.js +30 -0
  67. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.trendline.js +220 -0
  68. data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.trendline.min.js +30 -0
  69. data/lib/sunrise-votes.rb +2 -0
  70. data/lib/sunrise/votes.rb +12 -0
  71. data/lib/sunrise/votes/engine.rb +18 -0
  72. data/lib/sunrise/votes/version.rb +5 -0
  73. metadata +164 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.0b1_r746
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(e){e.jqplot.FunnelRenderer=function(){e.jqplot.LineRenderer.call(this)};e.jqplot.FunnelRenderer.prototype=new e.jqplot.LineRenderer();e.jqplot.FunnelRenderer.prototype.constructor=e.jqplot.FunnelRenderer;e.jqplot.FunnelRenderer.prototype.init=function(p,t){this.padding={top:20,right:20,bottom:20,left:20};this.sectionMargin=6;this.fill=true;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=5;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.widthRatio=0.2;this.lineWidth=2;this.dataLabels="percent";this.showDataLabels=false;this.dataLabelFormatString=null;this.dataLabelThreshold=3;this._type="funnel";this.tickRenderer=e.jqplot.FunnelTickRenderer;if(p.highlightMouseDown&&p.highlightMouseOver==null){p.highlightMouseOver=false}e.extend(true,this,p);this._highlightedPoint=null;this._bases=[];this._atot;this._areas=[];this._lengths=[];this._angle;this._dataIndices=[];this._unorderedData=e.extend(true,[],this.data);var o=e.extend(true,[],this.data);for(var r=0;r<o.length;r++){o[r].push(r)}this.data.sort(function(v,u){return u[1]-v[1]});o.sort(function(v,u){return u[1]-v[1]});for(var r=0;r<o.length;r++){this._dataIndices.push(o[r][2])}if(this.highlightColors.length==0){for(var r=0;r<this.seriesColors.length;r++){var q=e.jqplot.getColorComponents(this.seriesColors[r]);var m=[q[0],q[1],q[2]];var s=m[0]+m[1]+m[2];for(var n=0;n<3;n++){m[n]=(s>570)?m[n]*0.8:m[n]+0.4*(255-m[n]);m[n]=parseInt(m[n],10)}this.highlightColors.push("rgb("+m[0]+","+m[1]+","+m[2]+")")}}t.postParseOptionsHooks.addOnce(k);t.postInitHooks.addOnce(g);t.eventListenerHooks.addOnce("jqplotMouseMove",a);t.eventListenerHooks.addOnce("jqplotMouseDown",b);t.eventListenerHooks.addOnce("jqplotMouseUp",j);t.eventListenerHooks.addOnce("jqplotClick",f);t.eventListenerHooks.addOnce("jqplotRightClick",l);t.postDrawHooks.addOnce(h)};e.jqplot.FunnelRenderer.prototype.setGridData=function(o){var n=0;var p=[];for(var m=0;m<this.data.length;m++){n+=this.data[m][1];p.push([this.data[m][0],this.data[m][1]])}for(var m=0;m<p.length;m++){p[m][1]=p[m][1]/n}this._bases=new Array(p.length+1);this._lengths=new Array(p.length);this.gridData=p};e.jqplot.FunnelRenderer.prototype.makeGridData=function(o,p){var n=0;var q=[];for(var m=0;m<this.data.length;m++){n+=this.data[m][1];q.push([this.data[m][0],this.data[m][1]])}for(var m=0;m<q.length;m++){q[m][1]=q[m][1]/n}this._bases=new Array(q.length+1);this._lengths=new Array(q.length);return q};e.jqplot.FunnelRenderer.prototype.drawSection=function(n,p,o,s){var t=this.fill;var m=this.lineWidth;n.save();if(s){for(var r=0;r<this.shadowDepth;r++){n.save();n.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));q()}}else{q()}function q(){n.beginPath();n.fillStyle=o;n.strokeStyle=o;n.lineWidth=m;n.moveTo(p[0][0],p[0][1]);for(var u=1;u<4;u++){n.lineTo(p[u][0],p[u][1])}n.closePath();if(t){n.fill()}else{n.stroke()}}if(s){for(var r=0;r<this.shadowDepth;r++){n.restore()}}n.restore()};e.jqplot.FunnelRenderer.prototype.draw=function(G,B,J,p){var Y;var L=(J!=undefined)?J:{};var w=0;var u=0;var R=1;this._areas=[];if(J.legendInfo&&J.legendInfo.placement=="insideGrid"){var O=J.legendInfo;switch(O.location){case"nw":w=O.width+O.xoffset;break;case"w":w=O.width+O.xoffset;break;case"sw":w=O.width+O.xoffset;break;case"ne":w=O.width+O.xoffset;R=-1;break;case"e":w=O.width+O.xoffset;R=-1;break;case"se":w=O.width+O.xoffset;R=-1;break;case"n":u=O.height+O.yoffset;break;case"s":u=O.height+O.yoffset;R=-1;break;default:break}}var t=(R==1)?this.padding.left+w:this.padding.left;var F=(R==1)?this.padding.top+u:this.padding.top;var M=(R==-1)?this.padding.right+w:this.padding.right;var o=(R==-1)?this.padding.bottom+u:this.padding.bottom;var P=(L.shadow!=undefined)?L.shadow:this.shadow;var q=(L.showLine!=undefined)?L.showLine:this.showLine;var C=(L.fill!=undefined)?L.fill:this.fill;var H=G.canvas.width;var N=G.canvas.height;this._bases[0]=H-t-M;var I=this._length=N-F-o;var r=this._bases[0]*this.widthRatio;this._atot=I/2*(this._bases[0]+this._bases[0]*this.widthRatio);this._angle=Math.atan((this._bases[0]-r)/2/I);for(Y=0;Y<B.length;Y++){this._areas.push(B[Y][1]*this._atot)}var E,aa,W,Q=0;var n=0.0001;for(Y=0;Y<this._areas.length;Y++){E=this._areas[Y]/this._bases[Y];aa=999999;this._lengths[Y]=E;W=0;while(aa>this._lengths[Y]*n&&W<100){this._lengths[Y]=this._areas[Y]/(this._bases[Y]-this._lengths[Y]*Math.tan(this._angle));aa=Math.abs(this._lengths[Y]-E);this._bases[Y+1]=this._bases[Y]-(2*this._lengths[Y]*Math.tan(this._angle));E=this._lengths[Y];W++}Q+=this._lengths[Y]}this._vertices=new Array(B.length);var ae=[t,F],ad=[t+this._bases[0],F],ac=[t+(this._bases[0]-this._bases[this._bases.length-1])/2,F+this._length],ab=[ac[0]+this._bases[this._bases.length-1],ac[1]];function V(ag){var x=(ae[1]-ac[1])/(ae[0]-ac[0]);var v=ae[1]-x*ae[0];var ah=ag+ae[1];return[(ah-v)/x,ah]}function D(ag){var x=(ad[1]-ab[1])/(ad[0]-ab[0]);var v=ad[1]-x*ad[0];var ah=ag+ad[1];return[(ah-v)/x,ah]}var T=w,S=u;var Z=0,m=0;for(Y=0;Y<B.length;Y++){this._vertices[Y]=new Array();var U=this._vertices[Y];var A=this.sectionMargin;if(Y==0){m=0}if(Y==1){m=A/3}else{if(Y>0&&Y<B.length-1){m=A/2}else{if(Y==B.length-1){m=2*A/3}}}U.push(V(Z+m));U.push(D(Z+m));Z+=this._lengths[Y];if(Y==0){m=-2*A/3}else{if(Y>0&&Y<B.length-1){m=-A/2}else{if(Y==B.length-1){m=0}}}U.push(D(Z+m));U.push(V(Z+m))}if(this.shadow){var af="rgba(0,0,0,"+this.shadowAlpha+")";for(var Y=0;Y<B.length;Y++){this.renderer.drawSection.call(this,G,this._vertices[Y],af,true)}}for(var Y=0;Y<B.length;Y++){var U=this._vertices[Y];this.renderer.drawSection.call(this,G,U,this.seriesColors[Y]);if(this.showDataLabels&&B[Y][1]*100>=this.dataLabelThreshold){var K,X;if(this.dataLabels=="label"){K=this.dataLabelFormatString||"%s";X=e.jqplot.sprintf(K,B[Y][0])}else{if(this.dataLabels=="value"){K=this.dataLabelFormatString||"%d";X=e.jqplot.sprintf(K,this.data[Y][1])}else{if(this.dataLabels=="percent"){K=this.dataLabelFormatString||"%d%%";X=e.jqplot.sprintf(K,B[Y][1]*100)}else{if(this.dataLabels.constructor==Array){K=this.dataLabelFormatString||"%s";X=e.jqplot.sprintf(K,this.dataLabels[this._dataIndices[Y]])}}}}var s=(this._radius)*this.dataLabelPositionFactor+this.sliceMargin+this.dataLabelNudge;var T=(U[0][0]+U[1][0])/2+this.canvas._offsets.left;var S=(U[1][1]+U[2][1])/2+this.canvas._offsets.top;var z=e('<span class="jqplot-funnel-series jqplot-data-label" style="position:absolute;">'+X+"</span>").insertBefore(p.eventCanvas._elem);T-=z.width()/2;S-=z.height()/2;T=Math.round(T);S=Math.round(S);z.css({left:T,top:S})}}};e.jqplot.FunnelAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.FunnelAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.FunnelAxisRenderer.prototype.constructor=e.jqplot.FunnelAxisRenderer;e.jqplot.FunnelAxisRenderer.prototype.init=function(m){this.tickRenderer=e.jqplot.FunnelTickRenderer;e.extend(true,this,m);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.FunnelLegendRenderer=function(){e.jqplot.TableLegendRenderer.call(this)};e.jqplot.FunnelLegendRenderer.prototype=new e.jqplot.TableLegendRenderer();e.jqplot.FunnelLegendRenderer.prototype.constructor=e.jqplot.FunnelLegendRenderer;e.jqplot.FunnelLegendRenderer.prototype.init=function(m){this.numberRows=null;this.numberColumns=null;e.extend(true,this,m)};e.jqplot.FunnelLegendRenderer.prototype.draw=function(){var p=this;if(this.show){var x=this._series;var A="position:absolute;";A+=(this.background)?"background:"+this.background+";":"";A+=(this.border)?"border:"+this.border+";":"";A+=(this.fontSize)?"font-size:"+this.fontSize+";":"";A+=(this.fontFamily)?"font-family:"+this.fontFamily+";":"";A+=(this.textColor)?"color:"+this.textColor+";":"";A+=(this.marginTop!=null)?"margin-top:"+this.marginTop+";":"";A+=(this.marginBottom!=null)?"margin-bottom:"+this.marginBottom+";":"";A+=(this.marginLeft!=null)?"margin-left:"+this.marginLeft+";":"";A+=(this.marginRight!=null)?"margin-right:"+this.marginRight+";":"";this._elem=e('<table class="jqplot-table-legend" style="'+A+'"></table>');var E=false,w=false,m,u;var y=x[0];var n=new e.jqplot.ColorGenerator(y.seriesColors);if(y.show){var F=y.data;if(this.numberRows){m=this.numberRows;if(!this.numberColumns){u=Math.ceil(F.length/m)}else{u=this.numberColumns}}else{if(this.numberColumns){u=this.numberColumns;m=Math.ceil(F.length/this.numberColumns)}else{m=F.length;u=1}}var D,C,o,r,q,t,v,B;var z=0;for(D=0;D<m;D++){if(w){o=e('<tr class="jqplot-table-legend"></tr>').prependTo(this._elem)}else{o=e('<tr class="jqplot-table-legend"></tr>').appendTo(this._elem)}for(C=0;C<u;C++){if(z<F.length){t=this.labels[z]||F[z][0].toString();B=n.next();if(!w){if(D>0){E=true}else{E=false}}else{if(D==m-1){E=false}else{E=true}}v=(E)?this.rowSpacing:"0";r=e('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+v+';"><div><div class="jqplot-table-legend-swatch" style="border-color:'+B+';"></div></div></td>');q=e('<td class="jqplot-table-legend" style="padding-top:'+v+';"></td>');if(this.escapeHtml){q.text(t)}else{q.html(t)}if(w){q.prependTo(o);r.prependTo(o)}else{r.appendTo(o);q.appendTo(o)}E=true}z++}}}}return this._elem};function c(q,p,n){n=n||{};n.axesDefaults=n.axesDefaults||{};n.legend=n.legend||{};n.seriesDefaults=n.seriesDefaults||{};var m=false;if(n.seriesDefaults.renderer==e.jqplot.FunnelRenderer){m=true}else{if(n.series){for(var o=0;o<n.series.length;o++){if(n.series[o].renderer==e.jqplot.FunnelRenderer){m=true}}}}if(m){n.axesDefaults.renderer=e.jqplot.FunnelAxisRenderer;n.legend.renderer=e.jqplot.FunnelLegendRenderer;n.legend.preDraw=true;n.sortData=false;n.seriesDefaults.pointLabels={show:false}}}function g(p,o,m){for(var n=0;n<this.series.length;n++){if(this.series[n].renderer.constructor==e.jqplot.FunnelRenderer){if(this.series[n].highlightMouseOver){this.series[n].highlightMouseDown=false}}}this.target.bind("mouseout",{plot:this},function(q){i(q.data.plot)})}function k(m){for(var n=0;n<this.series.length;n++){this.series[n].seriesColors=this.seriesColors;this.series[n].colorGenerator=this.colorGenerator}}function d(q,p,o){var n=q.series[p];var m=q.plugins.funnelRenderer.highlightCanvas;m._ctx.clearRect(0,0,m._ctx.canvas.width,m._ctx.canvas.height);n._highlightedPoint=o;q.plugins.funnelRenderer.highlightedSeriesIndex=p;n.renderer.drawSection.call(n,m._ctx,n._vertices[o],n.highlightColors[o],false)}function i(o){var m=o.plugins.funnelRenderer.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.funnelRenderer.highlightedSeriesIndex=null;o.target.trigger("jqplotDataUnhighlight")}function a(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.funnelRenderer.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);d(r,o[0],o[1])}}else{if(s==null){i(r)}}}function b(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.funnelRenderer.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);d(q,n[0],n[1])}}else{if(r==null){i(q)}}}function j(o,n,r,q,p){var m=p.plugins.funnelRenderer.highlightedSeriesIndex;if(m!=null&&p.series[m].highlightMouseDown){i(p)}}function f(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.funnelRenderer.highlightedSeriesIndex;if(m!=null&&r.series[m].highlightMouseDown){i(r)}var n=jQuery.Event("jqplotDataRightClick");n.pageX=q.pageX;n.pageY=q.pageY;r.target.trigger(n,o)}}function h(){this.plugins.funnelRenderer={};this.plugins.funnelRenderer.highlightCanvas=new e.jqplot.GenericCanvas();var n=e(this.targetId+" .jqplot-data-label");if(n.length){e(n[0]).before(this.plugins.funnelRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-funnelRenderer-highlight-canvas",this._plotDimensions))}else{this.eventCanvas._elem.before(this.plugins.funnelRenderer.highlightCanvas.createElement(this._gridPadding,"jqplot-funnelRenderer-highlight-canvas",this._plotDimensions))}var m=this.plugins.funnelRenderer.highlightCanvas.setContext()}e.jqplot.preInitHooks.push(c);e.jqplot.FunnelTickRenderer=function(){e.jqplot.AxisTickRenderer.call(this)};e.jqplot.FunnelTickRenderer.prototype=new e.jqplot.AxisTickRenderer();e.jqplot.FunnelTickRenderer.prototype.constructor=e.jqplot.FunnelTickRenderer})(jQuery);
@@ -0,0 +1,406 @@
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.0b1_r746
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
+ $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
32
+
33
+ /**
34
+ * Class: $.jqplot.Highlighter
35
+ * Plugin which will highlight data points when they are moused over.
36
+ *
37
+ * To use this plugin, include the js
38
+ * file in your source:
39
+ *
40
+ * > <script type="text/javascript" src="plugins/jqplot.highlighter.js"></script>
41
+ *
42
+ * A tooltip providing information about the data point is enabled by default.
43
+ * To disable the tooltip, set "showTooltip" to false.
44
+ *
45
+ * You can control what data is displayed in the tooltip with various
46
+ * options. The "tooltipAxes" option controls wether the x, y or both
47
+ * data values are displayed.
48
+ *
49
+ * Some chart types (e.g. hi-low-close) have more than one y value per
50
+ * data point. To display the additional values in the tooltip, set the
51
+ * "yvalues" option to the desired number of y values present (3 for a hlc chart).
52
+ *
53
+ * By default, data values will be formatted with the same formatting
54
+ * specifiers as used to format the axis ticks. A custom format code
55
+ * can be supplied with the tooltipFormatString option. This will apply
56
+ * to all values in the tooltip.
57
+ *
58
+ * For more complete control, the "formatString" option can be set. This
59
+ * Allows conplete control over tooltip formatting. Values are passed to
60
+ * the format string in an order determined by the "tooltipAxes" and "yvalues"
61
+ * options. So, if you have a hi-low-close chart and you just want to display
62
+ * the hi-low-close values in the tooltip, you could set a formatString like:
63
+ *
64
+ * > highlighter: {
65
+ * > tooltipAxes: 'y',
66
+ * > yvalues: 3,
67
+ * > formatString:'<table class="jqplot-highlighter">
68
+ * > <tr><td>hi:</td><td>%s</td></tr>
69
+ * > <tr><td>low:</td><td>%s</td></tr>
70
+ * > <tr><td>close:</td><td>%s</td></tr></table>'
71
+ * > }
72
+ *
73
+ */
74
+ $.jqplot.Highlighter = function(options) {
75
+ // Group: Properties
76
+ //
77
+ //prop: show
78
+ // true to show the highlight.
79
+ this.show = $.jqplot.config.enablePlugins;
80
+ // prop: markerRenderer
81
+ // Renderer used to draw the marker of the highlighted point.
82
+ // Renderer will assimilate attributes from the data point being highlighted,
83
+ // so no attributes need set on the renderer directly.
84
+ // Default is to turn off shadow drawing on the highlighted point.
85
+ this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false});
86
+ // prop: showMarker
87
+ // true to show the marker
88
+ this.showMarker = true;
89
+ // prop: lineWidthAdjust
90
+ // Pixels to add to the lineWidth of the highlight.
91
+ this.lineWidthAdjust = 2.5;
92
+ // prop: sizeAdjust
93
+ // Pixels to add to the overall size of the highlight.
94
+ this.sizeAdjust = 5;
95
+ // prop: showTooltip
96
+ // Show a tooltip with data point values.
97
+ this.showTooltip = true;
98
+ // prop: tooltipLocation
99
+ // Where to position tooltip, 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'
100
+ this.tooltipLocation = 'nw';
101
+ // prop: fadeTooltip
102
+ // true = fade in/out tooltip, flase = show/hide tooltip
103
+ this.fadeTooltip = true;
104
+ // prop: tooltipFadeSpeed
105
+ // 'slow', 'def', 'fast', or number of milliseconds.
106
+ this.tooltipFadeSpeed = "fast";
107
+ // prop: tooltipOffset
108
+ // Pixel offset of tooltip from the highlight.
109
+ this.tooltipOffset = 2;
110
+ // prop: tooltipAxes
111
+ // Which axes to display in tooltip, 'x', 'y' or 'both', 'xy' or 'yx'
112
+ // 'both' and 'xy' are equivalent, 'yx' reverses order of labels.
113
+ this.tooltipAxes = 'both';
114
+ // prop; tooltipSeparator
115
+ // String to use to separate x and y axes in tooltip.
116
+ this.tooltipSeparator = ', ';
117
+ // prop; tooltipContentEditor
118
+ // Function used to edit/augment/replace the formatted tooltip contents.
119
+ // Called as str = tooltipContentEditor(str, seriesIndex, pointIndex)
120
+ // where str is the generated tooltip html and seriesIndex and pointIndex identify
121
+ // the data point being highlighted. Should return the html for the tooltip contents.
122
+ this.tooltipContentEditor = null;
123
+ // prop: useAxesFormatters
124
+ // Use the x and y axes formatters to format the text in the tooltip.
125
+ this.useAxesFormatters = true;
126
+ // prop: tooltipFormatString
127
+ // sprintf format string for the tooltip.
128
+ // Uses Ash Searle's javascript sprintf implementation
129
+ // found here: http://hexmen.com/blog/2007/03/printf-sprintf/
130
+ // See http://perldoc.perl.org/functions/sprintf.html for reference.
131
+ // Additional "p" and "P" format specifiers added by Chris Leonello.
132
+ this.tooltipFormatString = '%.5P';
133
+ // prop: formatString
134
+ // alternative to tooltipFormatString
135
+ // will format the whole tooltip text, populating with x, y values as
136
+ // indicated by tooltipAxes option. So, you could have a tooltip like:
137
+ // 'Date: %s, number of cats: %d' to format the whole tooltip at one go.
138
+ // If useAxesFormatters is true, values will be formatted according to
139
+ // Axes formatters and you can populate your tooltip string with
140
+ // %s placeholders.
141
+ this.formatString = null;
142
+ // prop: yvalues
143
+ // Number of y values to expect in the data point array.
144
+ // Typically this is 1. Certain plots, like OHLC, will
145
+ // have more y values in each data point array.
146
+ this.yvalues = 1;
147
+ // prop: bringSeriesToFront
148
+ // This option requires jQuery 1.4+
149
+ // True to bring the series of the highlighted point to the front
150
+ // of other series.
151
+ this.bringSeriesToFront = false;
152
+ this._tooltipElem;
153
+ this.isHighlighting = false;
154
+
155
+ $.extend(true, this, options);
156
+ };
157
+
158
+ var locations = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'];
159
+ var locationIndicies = {'nw':0, 'n':1, 'ne':2, 'e':3, 'se':4, 's':5, 'sw':6, 'w':7};
160
+ var oppositeLocations = ['se', 's', 'sw', 'w', 'nw', 'n', 'ne', 'e'];
161
+
162
+ // axis.renderer.tickrenderer.formatter
163
+
164
+ // called with scope of plot
165
+ $.jqplot.Highlighter.init = function (target, data, opts){
166
+ var options = opts || {};
167
+ // add a highlighter attribute to the plot
168
+ this.plugins.highlighter = new $.jqplot.Highlighter(options.highlighter);
169
+ };
170
+
171
+ // called within scope of series
172
+ $.jqplot.Highlighter.parseOptions = function (defaults, options) {
173
+ // Add a showHighlight option to the series
174
+ // and set it to true by default.
175
+ this.showHighlight = true;
176
+ };
177
+
178
+ // called within context of plot
179
+ // create a canvas which we can draw on.
180
+ // insert it before the eventCanvas, so eventCanvas will still capture events.
181
+ $.jqplot.Highlighter.postPlotDraw = function() {
182
+ this.plugins.highlighter.highlightCanvas = new $.jqplot.GenericCanvas();
183
+
184
+ this.eventCanvas._elem.before(this.plugins.highlighter.highlightCanvas.createElement(this._gridPadding, 'jqplot-highlight-canvas', this._plotDimensions));
185
+ this.plugins.highlighter.highlightCanvas.setContext();
186
+
187
+ var p = this.plugins.highlighter;
188
+ p._tooltipElem = $('<div class="jqplot-highlighter-tooltip" style="position:absolute;display:none"></div>');
189
+ this.eventCanvas._elem.before(p._tooltipElem);
190
+ };
191
+
192
+ $.jqplot.preInitHooks.push($.jqplot.Highlighter.init);
193
+ $.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Highlighter.parseOptions);
194
+ $.jqplot.postDrawHooks.push($.jqplot.Highlighter.postPlotDraw);
195
+
196
+ function draw(plot, neighbor) {
197
+ var hl = plot.plugins.highlighter;
198
+ var s = plot.series[neighbor.seriesIndex];
199
+ var smr = s.markerRenderer;
200
+ var mr = hl.markerRenderer;
201
+ mr.style = smr.style;
202
+ mr.lineWidth = smr.lineWidth + hl.lineWidthAdjust;
203
+ mr.size = smr.size + hl.sizeAdjust;
204
+ var rgba = $.jqplot.getColorComponents(smr.color);
205
+ var newrgb = [rgba[0], rgba[1], rgba[2]];
206
+ var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
207
+ mr.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
208
+ mr.init();
209
+ mr.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], hl.highlightCanvas._ctx);
210
+ }
211
+
212
+ function showTooltip(plot, series, neighbor) {
213
+ // neighbor looks like: {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}
214
+ // gridData should be x,y pixel coords on the grid.
215
+ // add the plot._gridPadding to that to get x,y in the target.
216
+ var hl = plot.plugins.highlighter;
217
+ var elem = hl._tooltipElem;
218
+ if (hl.useAxesFormatters) {
219
+ var xf = series._xaxis._ticks[0].formatter;
220
+ var yf = series._yaxis._ticks[0].formatter;
221
+ var xfstr = series._xaxis._ticks[0].formatString;
222
+ var yfstr = series._yaxis._ticks[0].formatString;
223
+ var str;
224
+ var xstr = xf(xfstr, neighbor.data[0]);
225
+ var ystrs = [];
226
+ for (var i=1; i<hl.yvalues+1; i++) {
227
+ ystrs.push(yf(yfstr, neighbor.data[i]));
228
+ }
229
+ if (hl.formatString) {
230
+ switch (hl.tooltipAxes) {
231
+ case 'both':
232
+ case 'xy':
233
+ ystrs.unshift(xstr);
234
+ ystrs.unshift(hl.formatString);
235
+ str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
236
+ break;
237
+ case 'yx':
238
+ ystrs.push(xstr);
239
+ ystrs.unshift(hl.formatString);
240
+ str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
241
+ break;
242
+ case 'x':
243
+ str = $.jqplot.sprintf.apply($.jqplot.sprintf, [hl.formatString, xstr]);
244
+ break;
245
+ case 'y':
246
+ ystrs.unshift(hl.formatString);
247
+ str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
248
+ break;
249
+ default: // same as xy
250
+ ystrs.unshift(xstr);
251
+ ystrs.unshift(hl.formatString);
252
+ str = $.jqplot.sprintf.apply($.jqplot.sprintf, ystrs);
253
+ break;
254
+ }
255
+ }
256
+ else {
257
+ switch (hl.tooltipAxes) {
258
+ case 'both':
259
+ case 'xy':
260
+ str = xstr;
261
+ for (var i=0; i<ystrs.length; i++) {
262
+ str += hl.tooltipSeparator + ystrs[i];
263
+ }
264
+ break;
265
+ case 'yx':
266
+ str = '';
267
+ for (var i=0; i<ystrs.length; i++) {
268
+ str += ystrs[i] + hl.tooltipSeparator;
269
+ }
270
+ str += xstr;
271
+ break;
272
+ case 'x':
273
+ str = xstr;
274
+ break;
275
+ case 'y':
276
+ str = ystrs.join(hl.tooltipSeparator);
277
+ break;
278
+ default: // same as 'xy'
279
+ str = xstr;
280
+ for (var i=0; i<ystrs.length; i++) {
281
+ str += hl.tooltipSeparator + ystrs[i];
282
+ }
283
+ break;
284
+
285
+ }
286
+ }
287
+ }
288
+ else {
289
+ var str;
290
+ if (hl.tooltipAxes == 'both' || hl.tooltipAxes == 'xy') {
291
+ str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[0]) + hl.tooltipSeparator + $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[1]);
292
+ }
293
+ else if (hl.tooltipAxes == 'yx') {
294
+ str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[1]) + hl.tooltipSeparator + $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[0]);
295
+ }
296
+ else if (hl.tooltipAxes == 'x') {
297
+ str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[0]);
298
+ }
299
+ else if (hl.tooltipAxes == 'y') {
300
+ str = $.jqplot.sprintf(hl.tooltipFormatString, neighbor.data[1]);
301
+ }
302
+ }
303
+ if ($.isFunction(hl.tooltipContentEditor)) {
304
+ // args str, seriesIndex, pointIndex are essential so the hook can look up
305
+ // extra data for the point.
306
+ str = hl.tooltipContentEditor(str, neighbor.seriesIndex, neighbor.pointIndex, plot);
307
+ }
308
+ elem.html(str);
309
+ var gridpos = {x:neighbor.gridData[0], y:neighbor.gridData[1]};
310
+ var ms = 0;
311
+ var fact = 0.707;
312
+ if (series.markerRenderer.show == true) {
313
+ ms = (series.markerRenderer.size + hl.sizeAdjust)/2;
314
+ }
315
+
316
+ var loc = locations;
317
+ if (series.fillToZero && series.fill && neighbor.data[1] < 0) {
318
+ loc = oppositeLocations;
319
+ }
320
+
321
+ switch (loc[locationIndicies[hl.tooltipLocation]]) {
322
+ case 'nw':
323
+ var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - fact * ms;
324
+ var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - fact * ms;
325
+ break;
326
+ case 'n':
327
+ var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
328
+ var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - ms;
329
+ break;
330
+ case 'ne':
331
+ var x = gridpos.x + plot._gridPadding.left + hl.tooltipOffset + fact * ms;
332
+ var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - fact * ms;
333
+ break;
334
+ case 'e':
335
+ var x = gridpos.x + plot._gridPadding.left + hl.tooltipOffset + ms;
336
+ var y = gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
337
+ break;
338
+ case 'se':
339
+ var x = gridpos.x + plot._gridPadding.left + hl.tooltipOffset + fact * ms;
340
+ var y = gridpos.y + plot._gridPadding.top + hl.tooltipOffset + fact * ms;
341
+ break;
342
+ case 's':
343
+ var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true)/2;
344
+ var y = gridpos.y + plot._gridPadding.top + hl.tooltipOffset + ms;
345
+ break;
346
+ case 'sw':
347
+ var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - fact * ms;
348
+ var y = gridpos.y + plot._gridPadding.top + hl.tooltipOffset + fact * ms;
349
+ break;
350
+ case 'w':
351
+ var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - ms;
352
+ var y = gridpos.y + plot._gridPadding.top - elem.outerHeight(true)/2;
353
+ break;
354
+ default: // same as 'nw'
355
+ var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - hl.tooltipOffset - fact * ms;
356
+ var y = gridpos.y + plot._gridPadding.top - hl.tooltipOffset - elem.outerHeight(true) - fact * ms;
357
+ break;
358
+ }
359
+ elem.css('left', x);
360
+ elem.css('top', y);
361
+ if (hl.fadeTooltip) {
362
+ // Fix for stacked up animations. Thnanks Trevor!
363
+ elem.stop(true,true).fadeIn(hl.tooltipFadeSpeed);
364
+ }
365
+ else {
366
+ elem.show();
367
+ }
368
+ elem = null;
369
+
370
+ }
371
+
372
+ function handleMove(ev, gridpos, datapos, neighbor, plot) {
373
+ var hl = plot.plugins.highlighter;
374
+ var c = plot.plugins.cursor;
375
+ if (hl.show) {
376
+ if (neighbor == null && hl.isHighlighting) {
377
+ var ctx = hl.highlightCanvas._ctx;
378
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
379
+ if (hl.fadeTooltip) {
380
+ hl._tooltipElem.fadeOut(hl.tooltipFadeSpeed);
381
+ }
382
+ else {
383
+ hl._tooltipElem.hide();
384
+ }
385
+ if (hl.bringSeriesToFront) {
386
+ plot.restorePreviousSeriesOrder();
387
+ }
388
+ hl.isHighlighting = false;
389
+ ctx = null;
390
+
391
+ }
392
+ else if (neighbor != null && plot.series[neighbor.seriesIndex].showHighlight && !hl.isHighlighting) {
393
+ hl.isHighlighting = true;
394
+ if (hl.showMarker) {
395
+ draw(plot, neighbor);
396
+ }
397
+ if (hl.showTooltip && (!c || !c._zoom.started)) {
398
+ showTooltip(plot, plot.series[neighbor.seriesIndex], neighbor);
399
+ }
400
+ if (hl.bringSeriesToFront) {
401
+ plot.moveSeriesToFront(neighbor.seriesIndex);
402
+ }
403
+ }
404
+ }
405
+ }
406
+ })(jQuery);
@@ -0,0 +1,30 @@
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.0b1_r746
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(d){d.jqplot.eventListenerHooks.push(["jqplotMouseMove",f]);d.jqplot.Highlighter=function(h){this.show=d.jqplot.config.enablePlugins;this.markerRenderer=new d.jqplot.MarkerRenderer({shadow:false});this.showMarker=true;this.lineWidthAdjust=2.5;this.sizeAdjust=5;this.showTooltip=true;this.tooltipLocation="nw";this.fadeTooltip=true;this.tooltipFadeSpeed="fast";this.tooltipOffset=2;this.tooltipAxes="both";this.tooltipSeparator=", ";this.tooltipContentEditor=null;this.useAxesFormatters=true;this.tooltipFormatString="%.5P";this.formatString=null;this.yvalues=1;this.bringSeriesToFront=false;this._tooltipElem;this.isHighlighting=false;d.extend(true,this,h)};var b=["nw","n","ne","e","se","s","sw","w"];var e={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7};var c=["se","s","sw","w","nw","n","ne","e"];d.jqplot.Highlighter.init=function(k,j,i){var h=i||{};this.plugins.highlighter=new d.jqplot.Highlighter(h.highlighter)};d.jqplot.Highlighter.parseOptions=function(i,h){this.showHighlight=true};d.jqplot.Highlighter.postPlotDraw=function(){this.plugins.highlighter.highlightCanvas=new d.jqplot.GenericCanvas();this.eventCanvas._elem.before(this.plugins.highlighter.highlightCanvas.createElement(this._gridPadding,"jqplot-highlight-canvas",this._plotDimensions));this.plugins.highlighter.highlightCanvas.setContext();var h=this.plugins.highlighter;h._tooltipElem=d('<div class="jqplot-highlighter-tooltip" style="position:absolute;display:none"></div>');this.eventCanvas._elem.before(h._tooltipElem)};d.jqplot.preInitHooks.push(d.jqplot.Highlighter.init);d.jqplot.preParseSeriesOptionsHooks.push(d.jqplot.Highlighter.parseOptions);d.jqplot.postDrawHooks.push(d.jqplot.Highlighter.postPlotDraw);function a(m,o){var j=m.plugins.highlighter;var p=m.series[o.seriesIndex];var h=p.markerRenderer;var i=j.markerRenderer;i.style=h.style;i.lineWidth=h.lineWidth+j.lineWidthAdjust;i.size=h.size+j.sizeAdjust;var l=d.jqplot.getColorComponents(h.color);var n=[l[0],l[1],l[2]];var k=(l[3]>=0.6)?l[3]*0.6:l[3]*(2-l[3]);i.color="rgba("+n[0]+","+n[1]+","+n[2]+","+k+")";i.init();i.draw(p.gridData[o.pointIndex][0],p.gridData[o.pointIndex][1],j.highlightCanvas._ctx)}function g(w,q,m){var k=w.plugins.highlighter;var B=k._tooltipElem;if(k.useAxesFormatters){var u=q._xaxis._ticks[0].formatter;var h=q._yaxis._ticks[0].formatter;var C=q._xaxis._ticks[0].formatString;var r=q._yaxis._ticks[0].formatString;var v;var s=u(C,m.data[0]);var l=[];for(var z=1;z<k.yvalues+1;z++){l.push(h(r,m.data[z]))}if(k.formatString){switch(k.tooltipAxes){case"both":case"xy":l.unshift(s);l.unshift(k.formatString);v=d.jqplot.sprintf.apply(d.jqplot.sprintf,l);break;case"yx":l.push(s);l.unshift(k.formatString);v=d.jqplot.sprintf.apply(d.jqplot.sprintf,l);break;case"x":v=d.jqplot.sprintf.apply(d.jqplot.sprintf,[k.formatString,s]);break;case"y":l.unshift(k.formatString);v=d.jqplot.sprintf.apply(d.jqplot.sprintf,l);break;default:l.unshift(s);l.unshift(k.formatString);v=d.jqplot.sprintf.apply(d.jqplot.sprintf,l);break}}else{switch(k.tooltipAxes){case"both":case"xy":v=s;for(var z=0;z<l.length;z++){v+=k.tooltipSeparator+l[z]}break;case"yx":v="";for(var z=0;z<l.length;z++){v+=l[z]+k.tooltipSeparator}v+=s;break;case"x":v=s;break;case"y":v=l.join(k.tooltipSeparator);break;default:v=s;for(var z=0;z<l.length;z++){v+=k.tooltipSeparator+l[z]}break}}}else{var v;if(k.tooltipAxes=="both"||k.tooltipAxes=="xy"){v=d.jqplot.sprintf(k.tooltipFormatString,m.data[0])+k.tooltipSeparator+d.jqplot.sprintf(k.tooltipFormatString,m.data[1])}else{if(k.tooltipAxes=="yx"){v=d.jqplot.sprintf(k.tooltipFormatString,m.data[1])+k.tooltipSeparator+d.jqplot.sprintf(k.tooltipFormatString,m.data[0])}else{if(k.tooltipAxes=="x"){v=d.jqplot.sprintf(k.tooltipFormatString,m.data[0])}else{if(k.tooltipAxes=="y"){v=d.jqplot.sprintf(k.tooltipFormatString,m.data[1])}}}}}if(d.isFunction(k.tooltipContentEditor)){v=k.tooltipContentEditor(v,m.seriesIndex,m.pointIndex,w)}B.html(v);var A={x:m.gridData[0],y:m.gridData[1]};var t=0;var j=0.707;if(q.markerRenderer.show==true){t=(q.markerRenderer.size+k.sizeAdjust)/2}var o=b;if(q.fillToZero&&q.fill&&m.data[1]<0){o=c}switch(o[e[k.tooltipLocation]]){case"nw":var p=A.x+w._gridPadding.left-B.outerWidth(true)-k.tooltipOffset-j*t;var n=A.y+w._gridPadding.top-k.tooltipOffset-B.outerHeight(true)-j*t;break;case"n":var p=A.x+w._gridPadding.left-B.outerWidth(true)/2;var n=A.y+w._gridPadding.top-k.tooltipOffset-B.outerHeight(true)-t;break;case"ne":var p=A.x+w._gridPadding.left+k.tooltipOffset+j*t;var n=A.y+w._gridPadding.top-k.tooltipOffset-B.outerHeight(true)-j*t;break;case"e":var p=A.x+w._gridPadding.left+k.tooltipOffset+t;var n=A.y+w._gridPadding.top-B.outerHeight(true)/2;break;case"se":var p=A.x+w._gridPadding.left+k.tooltipOffset+j*t;var n=A.y+w._gridPadding.top+k.tooltipOffset+j*t;break;case"s":var p=A.x+w._gridPadding.left-B.outerWidth(true)/2;var n=A.y+w._gridPadding.top+k.tooltipOffset+t;break;case"sw":var p=A.x+w._gridPadding.left-B.outerWidth(true)-k.tooltipOffset-j*t;var n=A.y+w._gridPadding.top+k.tooltipOffset+j*t;break;case"w":var p=A.x+w._gridPadding.left-B.outerWidth(true)-k.tooltipOffset-t;var n=A.y+w._gridPadding.top-B.outerHeight(true)/2;break;default:var p=A.x+w._gridPadding.left-B.outerWidth(true)-k.tooltipOffset-j*t;var n=A.y+w._gridPadding.top-k.tooltipOffset-B.outerHeight(true)-j*t;break}B.css("left",p);B.css("top",n);if(k.fadeTooltip){B.stop(true,true).fadeIn(k.tooltipFadeSpeed)}else{B.show()}B=null}function f(k,j,n,m,l){var h=l.plugins.highlighter;var o=l.plugins.cursor;if(h.show){if(m==null&&h.isHighlighting){var i=h.highlightCanvas._ctx;i.clearRect(0,0,i.canvas.width,i.canvas.height);if(h.fadeTooltip){h._tooltipElem.fadeOut(h.tooltipFadeSpeed)}else{h._tooltipElem.hide()}if(h.bringSeriesToFront){l.restorePreviousSeriesOrder()}h.isHighlighting=false;i=null}else{if(m!=null&&l.series[m.seriesIndex].showHighlight&&!h.isHighlighting){h.isHighlighting=true;if(h.showMarker){a(l,m)}if(h.showTooltip&&(!o||!o._zoom.started)){g(l,l.series[m.seriesIndex],m)}if(h.bringSeriesToFront){l.moveSeriesToFront(m.seriesIndex)}}}}}})(jQuery);