mdoc 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +2 -2
  3. data/examples/jqplot.html +62 -0
  4. data/examples/jqplot.md +8 -0
  5. data/examples/js/jquery.jqplot.css +259 -0
  6. data/examples/js/jquery.jqplot.js +11411 -0
  7. data/examples/js/jquery.jqplot.min.css +1 -0
  8. data/examples/js/jquery.jqplot.min.js +3 -0
  9. data/examples/js/jquery.js +9597 -0
  10. data/examples/js/jquery.min.js +5 -0
  11. data/examples/js/plugins/jqplot.BezierCurveRenderer.js +314 -0
  12. data/examples/js/plugins/jqplot.BezierCurveRenderer.min.js +3 -0
  13. data/examples/js/plugins/jqplot.barRenderer.js +801 -0
  14. data/examples/js/plugins/jqplot.barRenderer.min.js +3 -0
  15. data/examples/js/plugins/jqplot.blockRenderer.js +235 -0
  16. data/examples/js/plugins/jqplot.blockRenderer.min.js +3 -0
  17. data/examples/js/plugins/jqplot.bubbleRenderer.js +759 -0
  18. data/examples/js/plugins/jqplot.bubbleRenderer.min.js +3 -0
  19. data/examples/js/plugins/jqplot.canvasAxisLabelRenderer.js +203 -0
  20. data/examples/js/plugins/jqplot.canvasAxisLabelRenderer.min.js +3 -0
  21. data/examples/js/plugins/jqplot.canvasAxisTickRenderer.js +253 -0
  22. data/examples/js/plugins/jqplot.canvasAxisTickRenderer.min.js +3 -0
  23. data/examples/js/plugins/jqplot.canvasOverlay.js +1021 -0
  24. data/examples/js/plugins/jqplot.canvasOverlay.min.js +3 -0
  25. data/examples/js/plugins/jqplot.canvasTextRenderer.js +449 -0
  26. data/examples/js/plugins/jqplot.canvasTextRenderer.min.js +3 -0
  27. data/examples/js/plugins/jqplot.categoryAxisRenderer.js +679 -0
  28. data/examples/js/plugins/jqplot.categoryAxisRenderer.min.js +3 -0
  29. data/examples/js/plugins/jqplot.ciParser.js +116 -0
  30. data/examples/js/plugins/jqplot.ciParser.min.js +3 -0
  31. data/examples/js/plugins/jqplot.cursor.js +1108 -0
  32. data/examples/js/plugins/jqplot.cursor.min.js +3 -0
  33. data/examples/js/plugins/jqplot.dateAxisRenderer.js +741 -0
  34. data/examples/js/plugins/jqplot.dateAxisRenderer.min.js +3 -0
  35. data/examples/js/plugins/jqplot.donutRenderer.js +805 -0
  36. data/examples/js/plugins/jqplot.donutRenderer.min.js +3 -0
  37. data/examples/js/plugins/jqplot.dragable.js +225 -0
  38. data/examples/js/plugins/jqplot.dragable.min.js +3 -0
  39. data/examples/js/plugins/jqplot.enhancedLegendRenderer.js +305 -0
  40. data/examples/js/plugins/jqplot.enhancedLegendRenderer.min.js +3 -0
  41. data/examples/js/plugins/jqplot.funnelRenderer.js +943 -0
  42. data/examples/js/plugins/jqplot.funnelRenderer.min.js +3 -0
  43. data/examples/js/plugins/jqplot.highlighter.js +465 -0
  44. data/examples/js/plugins/jqplot.highlighter.min.js +3 -0
  45. data/examples/js/plugins/jqplot.json2.js +475 -0
  46. data/examples/js/plugins/jqplot.json2.min.js +3 -0
  47. data/examples/js/plugins/jqplot.logAxisRenderer.js +534 -0
  48. data/examples/js/plugins/jqplot.logAxisRenderer.min.js +3 -0
  49. data/examples/js/plugins/jqplot.mekkoAxisRenderer.js +611 -0
  50. data/examples/js/plugins/jqplot.mekkoAxisRenderer.min.js +3 -0
  51. data/examples/js/plugins/jqplot.mekkoRenderer.js +437 -0
  52. data/examples/js/plugins/jqplot.mekkoRenderer.min.js +3 -0
  53. data/examples/js/plugins/jqplot.meterGaugeRenderer.js +1029 -0
  54. data/examples/js/plugins/jqplot.meterGaugeRenderer.min.js +3 -0
  55. data/examples/js/plugins/jqplot.mobile.js +45 -0
  56. data/examples/js/plugins/jqplot.mobile.min.js +3 -0
  57. data/examples/js/plugins/jqplot.ohlcRenderer.js +373 -0
  58. data/examples/js/plugins/jqplot.ohlcRenderer.min.js +3 -0
  59. data/examples/js/plugins/jqplot.pieRenderer.js +904 -0
  60. data/examples/js/plugins/jqplot.pieRenderer.min.js +3 -0
  61. data/examples/js/plugins/jqplot.pointLabels.js +377 -0
  62. data/examples/js/plugins/jqplot.pointLabels.min.js +3 -0
  63. data/examples/js/plugins/jqplot.pyramidAxisRenderer.js +728 -0
  64. data/examples/js/plugins/jqplot.pyramidAxisRenderer.min.js +3 -0
  65. data/examples/js/plugins/jqplot.pyramidGridRenderer.js +429 -0
  66. data/examples/js/plugins/jqplot.pyramidGridRenderer.min.js +3 -0
  67. data/examples/js/plugins/jqplot.pyramidRenderer.js +514 -0
  68. data/examples/js/plugins/jqplot.pyramidRenderer.min.js +3 -0
  69. data/examples/js/plugins/jqplot.trendline.js +223 -0
  70. data/examples/js/plugins/jqplot.trendline.min.js +3 -0
  71. data/examples/js/raphael-min.js +11 -0
  72. data/examples/js/sequence-diagram-min.js +8 -0
  73. data/examples/js/underscore-min.js +5 -0
  74. data/lib/mdoc.rb +1 -0
  75. data/lib/mdoc/processor/jqplot.rb +48 -0
  76. data/lib/mdoc/version.rb +1 -1
  77. data/templates/default.html.erb +1 -1
  78. metadata +74 -2
@@ -0,0 +1,3 @@
1
+ /* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
2
+ jsDate | (c) 2010-2013 Chris Leonello
3
+ */(function(j){j.jqplot.Cursor=function(q){this.style="crosshair";this.previousCursor="auto";this.show=j.jqplot.config.enablePlugins;this.showTooltip=true;this.followMouse=false;this.tooltipLocation="se";this.tooltipOffset=6;this.showTooltipGridPosition=false;this.showTooltipUnitPosition=true;this.showTooltipDataPosition=false;this.tooltipFormatString="%.4P, %.4P";this.useAxesFormatters=true;this.tooltipAxisGroups=[];this.zoom=false;this.zoomProxy=false;this.zoomTarget=false;this.looseZoom=true;this.clickReset=false;this.dblClickReset=true;this.showVerticalLine=false;this.showHorizontalLine=false;this.constrainZoomTo="none";this.shapeRenderer=new j.jqplot.ShapeRenderer();this._zoom={start:[],end:[],started:false,zooming:false,isZoomed:false,axes:{start:{},end:{}},gridpos:{},datapos:{}};this._tooltipElem;this.zoomCanvas;this.cursorCanvas;this.intersectionThreshold=2;this.showCursorLegend=false;this.cursorLegendFormatString=j.jqplot.Cursor.cursorLegendFormatString;this._oldHandlers={onselectstart:null,ondrag:null,onmousedown:null};this.constrainOutsideZoom=true;this.showTooltipOutsideZoom=false;this.onGrid=false;j.extend(true,this,q)};j.jqplot.Cursor.cursorLegendFormatString="%s x:%s, y:%s";j.jqplot.Cursor.init=function(t,s,r){var q=r||{};this.plugins.cursor=new j.jqplot.Cursor(q.cursor);var u=this.plugins.cursor;if(u.show){j.jqplot.eventListenerHooks.push(["jqplotMouseEnter",b]);j.jqplot.eventListenerHooks.push(["jqplotMouseLeave",f]);j.jqplot.eventListenerHooks.push(["jqplotMouseMove",i]);if(u.showCursorLegend){r.legend=r.legend||{};r.legend.renderer=j.jqplot.CursorLegendRenderer;r.legend.formatString=this.plugins.cursor.cursorLegendFormatString;r.legend.show=true}if(u.zoom){j.jqplot.eventListenerHooks.push(["jqplotMouseDown",a]);if(u.clickReset){j.jqplot.eventListenerHooks.push(["jqplotClick",k])}if(u.dblClickReset){j.jqplot.eventListenerHooks.push(["jqplotDblClick",c])}}this.resetZoom=function(){var x=this.axes;if(!u.zoomProxy){for(var w in x){x[w].reset();x[w]._ticks=[];if(u._zoom.axes[w]!==undefined){x[w]._autoFormatString=u._zoom.axes[w].tickFormatString}}this.redraw()}else{var v=this.plugins.cursor.zoomCanvas._ctx;v.clearRect(0,0,v.canvas.width,v.canvas.height);v=null}this.plugins.cursor._zoom.isZoomed=false;this.target.trigger("jqplotResetZoom",[this,this.plugins.cursor])};if(u.showTooltipDataPosition){u.showTooltipUnitPosition=false;u.showTooltipGridPosition=false;if(q.cursor.tooltipFormatString==undefined){u.tooltipFormatString=j.jqplot.Cursor.cursorLegendFormatString}}}};j.jqplot.Cursor.postDraw=function(){var x=this.plugins.cursor;if(x.zoomCanvas){x.zoomCanvas.resetCanvas();x.zoomCanvas=null}if(x.cursorCanvas){x.cursorCanvas.resetCanvas();x.cursorCanvas=null}if(x._tooltipElem){x._tooltipElem.emptyForce();x._tooltipElem=null}if(x.zoom){x.zoomCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(x.zoomCanvas.createElement(this._gridPadding,"jqplot-zoom-canvas",this._plotDimensions,this));x.zoomCanvas.setContext()}var v=document.createElement("div");x._tooltipElem=j(v);v=null;x._tooltipElem.addClass("jqplot-cursor-tooltip");x._tooltipElem.css({position:"absolute",display:"none"});if(x.zoomCanvas){x.zoomCanvas._elem.before(x._tooltipElem)}else{this.eventCanvas._elem.before(x._tooltipElem)}if(x.showVerticalLine||x.showHorizontalLine){x.cursorCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(x.cursorCanvas.createElement(this._gridPadding,"jqplot-cursor-canvas",this._plotDimensions,this));x.cursorCanvas.setContext()}if(x.showTooltipUnitPosition){if(x.tooltipAxisGroups.length===0){var t=this.series;var u;var q=[];for(var r=0;r<t.length;r++){u=t[r];var w=u.xaxis+","+u.yaxis;if(j.inArray(w,q)==-1){q.push(w)}}for(var r=0;r<q.length;r++){x.tooltipAxisGroups.push(q[r].split(","))}}}};j.jqplot.Cursor.zoomProxy=function(v,r){var q=v.plugins.cursor;var u=r.plugins.cursor;q.zoomTarget=true;q.zoom=true;q.style="auto";q.dblClickReset=false;u.zoom=true;u.zoomProxy=true;r.target.bind("jqplotZoom",t);r.target.bind("jqplotResetZoom",s);function t(x,w,z,y,A){q.doZoom(w,z,v,A)}function s(w,x,y){v.resetZoom()}};j.jqplot.Cursor.prototype.resetZoom=function(u,v){var t=u.axes;var s=v._zoom.axes;if(!u.plugins.cursor.zoomProxy&&v._zoom.isZoomed){for(var r in t){t[r].reset();t[r]._ticks=[];t[r]._autoFormatString=s[r].tickFormatString}u.redraw();v._zoom.isZoomed=false}else{var q=v.zoomCanvas._ctx;q.clearRect(0,0,q.canvas.width,q.canvas.height);q=null}u.target.trigger("jqplotResetZoom",[u,v])};j.jqplot.Cursor.resetZoom=function(q){q.resetZoom()};j.jqplot.Cursor.prototype.doZoom=function(G,t,C,u){var I=u;var F=C.axes;var r=I._zoom.axes;var w=r.start;var s=r.end;var B,E,z,D,v,x,q,H,J;var A=C.plugins.cursor.zoomCanvas._ctx;if((I.constrainZoomTo=="none"&&Math.abs(G.x-I._zoom.start[0])>6&&Math.abs(G.y-I._zoom.start[1])>6)||(I.constrainZoomTo=="x"&&Math.abs(G.x-I._zoom.start[0])>6)||(I.constrainZoomTo=="y"&&Math.abs(G.y-I._zoom.start[1])>6)){if(!C.plugins.cursor.zoomProxy){for(var y in t){if(I._zoom.axes[y]==undefined){I._zoom.axes[y]={};I._zoom.axes[y].numberTicks=F[y].numberTicks;I._zoom.axes[y].tickInterval=F[y].tickInterval;I._zoom.axes[y].daTickInterval=F[y].daTickInterval;I._zoom.axes[y].min=F[y].min;I._zoom.axes[y].max=F[y].max;I._zoom.axes[y].tickFormatString=(F[y].tickOptions!=null)?F[y].tickOptions.formatString:""}if((I.constrainZoomTo=="none")||(I.constrainZoomTo=="x"&&y.charAt(0)=="x")||(I.constrainZoomTo=="y"&&y.charAt(0)=="y")){z=t[y];if(z!=null){if(z>w[y]){v=w[y];x=z}else{D=w[y]-z;v=z;x=w[y]}q=F[y];H=null;if(q.alignTicks){if(q.name==="x2axis"&&C.axes.xaxis.show){H=C.axes.xaxis.numberTicks}else{if(q.name.charAt(0)==="y"&&q.name!=="yaxis"&&q.name!=="yMidAxis"&&C.axes.yaxis.show){H=C.axes.yaxis.numberTicks}}}if(this.looseZoom&&(F[y].renderer.constructor===j.jqplot.LinearAxisRenderer||F[y].renderer.constructor===j.jqplot.LogAxisRenderer)){J=j.jqplot.LinearTickGenerator(v,x,q._scalefact,H);if(F[y].tickInset&&J[0]<F[y].min+F[y].tickInset*F[y].tickInterval){J[0]+=J[4];J[2]-=1}if(F[y].tickInset&&J[1]>F[y].max-F[y].tickInset*F[y].tickInterval){J[1]-=J[4];J[2]-=1}if(F[y].renderer.constructor===j.jqplot.LogAxisRenderer&&J[0]<F[y].min){J[0]+=J[4];J[2]-=1}F[y].min=J[0];F[y].max=J[1];F[y]._autoFormatString=J[3];F[y].numberTicks=J[2];F[y].tickInterval=J[4];F[y].daTickInterval=[J[4]/1000,"seconds"]}else{F[y].min=v;F[y].max=x;F[y].tickInterval=null;F[y].numberTicks=null;F[y].daTickInterval=null}F[y]._ticks=[]}}}A.clearRect(0,0,A.canvas.width,A.canvas.height);C.redraw();I._zoom.isZoomed=true;A=null}C.target.trigger("jqplotZoom",[G,t,C,u])}};j.jqplot.preInitHooks.push(j.jqplot.Cursor.init);j.jqplot.postDrawHooks.push(j.jqplot.Cursor.postDraw);function e(G,r,C){var J=C.plugins.cursor;var w="";var N=false;if(J.showTooltipGridPosition){w=G.x+", "+G.y;N=true}if(J.showTooltipUnitPosition){var F;for(var E=0;E<J.tooltipAxisGroups.length;E++){F=J.tooltipAxisGroups[E];if(N){w+="<br />"}if(J.useAxesFormatters){for(var D=0;D<F.length;D++){if(D){w+=", "}var H=C.axes[F[D]]._ticks[0].formatter;var B=C.axes[F[D]]._ticks[0].formatString;w+=H(B,r[F[D]])}}else{w+=j.jqplot.sprintf(J.tooltipFormatString,r[F[0]],r[F[1]])}N=true}}if(J.showTooltipDataPosition){var u=C.series;var M=d(C,G.x,G.y);var N=false;for(var E=0;E<u.length;E++){if(u[E].show){var y=u[E].index;var t=u[E].label.toString();var I=j.inArray(y,M.indices);var z=undefined;var x=undefined;if(I!=-1){var L=M.data[I].data;if(J.useAxesFormatters){var A=u[E]._xaxis._ticks[0].formatter;var q=u[E]._yaxis._ticks[0].formatter;var K=u[E]._xaxis._ticks[0].formatString;var v=u[E]._yaxis._ticks[0].formatString;z=A(K,L[0]);x=q(v,L[1])}else{z=L[0];x=L[1]}if(N){w+="<br />"}w+=j.jqplot.sprintf(J.tooltipFormatString,t,z,x);N=true}}}}J._tooltipElem.html(w)}function g(C,A){var E=A.plugins.cursor;var z=E.cursorCanvas._ctx;z.clearRect(0,0,z.canvas.width,z.canvas.height);if(E.showVerticalLine){E.shapeRenderer.draw(z,[[C.x,0],[C.x,z.canvas.height]])}if(E.showHorizontalLine){E.shapeRenderer.draw(z,[[0,C.y],[z.canvas.width,C.y]])}var G=d(A,C.x,C.y);if(E.showCursorLegend){var r=j(A.targetId+" td.jqplot-cursor-legend-label");for(var B=0;B<r.length;B++){var v=j(r[B]).data("seriesIndex");var t=A.series[v];var s=t.label.toString();var D=j.inArray(v,G.indices);var x=undefined;var w=undefined;if(D!=-1){var H=G.data[D].data;if(E.useAxesFormatters){var y=t._xaxis._ticks[0].formatter;var q=t._yaxis._ticks[0].formatter;var F=t._xaxis._ticks[0].formatString;var u=t._yaxis._ticks[0].formatString;x=y(F,H[0]);w=q(u,H[1])}else{x=H[0];w=H[1]}}if(A.legend.escapeHtml){j(r[B]).text(j.jqplot.sprintf(E.cursorLegendFormatString,s,x,w))}else{j(r[B]).html(j.jqplot.sprintf(E.cursorLegendFormatString,s,x,w))}}}z=null}function d(A,F,E){var B={indices:[],data:[]};var G,w,u,C,v,q,t;var z;var D=A.plugins.cursor;for(var w=0;w<A.series.length;w++){G=A.series[w];q=G.renderer;if(G.show){z=D.intersectionThreshold;if(G.showMarker){z+=G.markerRenderer.size/2}for(var v=0;v<G.gridData.length;v++){t=G.gridData[v];if(D.showVerticalLine){if(Math.abs(F-t[0])<=z){B.indices.push(w);B.data.push({seriesIndex:w,pointIndex:v,gridData:t,data:G.data[v]})}}}}}return B}function n(r,t){var v=t.plugins.cursor;var s=v._tooltipElem;switch(v.tooltipLocation){case"nw":var q=r.x+t._gridPadding.left-s.outerWidth(true)-v.tooltipOffset;var u=r.y+t._gridPadding.top-v.tooltipOffset-s.outerHeight(true);break;case"n":var q=r.x+t._gridPadding.left-s.outerWidth(true)/2;var u=r.y+t._gridPadding.top-v.tooltipOffset-s.outerHeight(true);break;case"ne":var q=r.x+t._gridPadding.left+v.tooltipOffset;var u=r.y+t._gridPadding.top-v.tooltipOffset-s.outerHeight(true);break;case"e":var q=r.x+t._gridPadding.left+v.tooltipOffset;var u=r.y+t._gridPadding.top-s.outerHeight(true)/2;break;case"se":var q=r.x+t._gridPadding.left+v.tooltipOffset;var u=r.y+t._gridPadding.top+v.tooltipOffset;break;case"s":var q=r.x+t._gridPadding.left-s.outerWidth(true)/2;var u=r.y+t._gridPadding.top+v.tooltipOffset;break;case"sw":var q=r.x+t._gridPadding.left-s.outerWidth(true)-v.tooltipOffset;var u=r.y+t._gridPadding.top+v.tooltipOffset;break;case"w":var q=r.x+t._gridPadding.left-s.outerWidth(true)-v.tooltipOffset;var u=r.y+t._gridPadding.top-s.outerHeight(true)/2;break;default:var q=r.x+t._gridPadding.left+v.tooltipOffset;var u=r.y+t._gridPadding.top+v.tooltipOffset;break}s.css("left",q);s.css("top",u);s=null}function m(u){var s=u._gridPadding;var v=u.plugins.cursor;var t=v._tooltipElem;switch(v.tooltipLocation){case"nw":var r=s.left+v.tooltipOffset;var q=s.top+v.tooltipOffset;t.css("left",r);t.css("top",q);break;case"n":var r=(s.left+(u._plotDimensions.width-s.right))/2-t.outerWidth(true)/2;var q=s.top+v.tooltipOffset;t.css("left",r);t.css("top",q);break;case"ne":var r=s.right+v.tooltipOffset;var q=s.top+v.tooltipOffset;t.css({right:r,top:q});break;case"e":var r=s.right+v.tooltipOffset;var q=(s.top+(u._plotDimensions.height-s.bottom))/2-t.outerHeight(true)/2;t.css({right:r,top:q});break;case"se":var r=s.right+v.tooltipOffset;var q=s.bottom+v.tooltipOffset;t.css({right:r,bottom:q});break;case"s":var r=(s.left+(u._plotDimensions.width-s.right))/2-t.outerWidth(true)/2;var q=s.bottom+v.tooltipOffset;t.css({left:r,bottom:q});break;case"sw":var r=s.left+v.tooltipOffset;var q=s.bottom+v.tooltipOffset;t.css({left:r,bottom:q});break;case"w":var r=s.left+v.tooltipOffset;var q=(s.top+(u._plotDimensions.height-s.bottom))/2-t.outerHeight(true)/2;t.css({left:r,top:q});break;default:var r=s.right-v.tooltipOffset;var q=s.bottom+v.tooltipOffset;t.css({right:r,bottom:q});break}t=null}function k(r,q,v,u,t){r.preventDefault();r.stopImmediatePropagation();var w=t.plugins.cursor;if(w.clickReset){w.resetZoom(t,w)}var s=window.getSelection;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(s&&!s().isCollapsed){s().collapse()}}return false}function c(r,q,v,u,t){r.preventDefault();r.stopImmediatePropagation();var w=t.plugins.cursor;if(w.dblClickReset){w.resetZoom(t,w)}var s=window.getSelection;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(s&&!s().isCollapsed){s().collapse()}}return false}function f(w,t,q,z,u){var v=u.plugins.cursor;v.onGrid=false;if(v.show){j(w.target).css("cursor",v.previousCursor);if(v.showTooltip&&!(v._zoom.zooming&&v.showTooltipOutsideZoom&&!v.constrainOutsideZoom)){v._tooltipElem.empty();v._tooltipElem.hide()}if(v.zoom){v._zoom.gridpos=t;v._zoom.datapos=q}if(v.showVerticalLine||v.showHorizontalLine){var B=v.cursorCanvas._ctx;B.clearRect(0,0,B.canvas.width,B.canvas.height);B=null}if(v.showCursorLegend){var A=j(u.targetId+" td.jqplot-cursor-legend-label");for(var s=0;s<A.length;s++){var y=j(A[s]).data("seriesIndex");var r=u.series[y];var x=r.label.toString();if(u.legend.escapeHtml){j(A[s]).text(j.jqplot.sprintf(v.cursorLegendFormatString,x,undefined,undefined))}else{j(A[s]).html(j.jqplot.sprintf(v.cursorLegendFormatString,x,undefined,undefined))}}}}}function b(r,q,u,t,s){var v=s.plugins.cursor;v.onGrid=true;if(v.show){v.previousCursor=r.target.style.cursor;r.target.style.cursor=v.style;if(v.showTooltip){e(q,u,s);if(v.followMouse){n(q,s)}else{m(s)}v._tooltipElem.show()}if(v.showVerticalLine||v.showHorizontalLine){g(q,s)}}}function i(r,q,u,t,s){var v=s.plugins.cursor;if(v.show){if(v.showTooltip){e(q,u,s);if(v.followMouse){n(q,s)}}if(v.showVerticalLine||v.showHorizontalLine){g(q,s)}}}function o(y){var x=y.data.plot;var t=x.eventCanvas._elem.offset();var w={x:y.pageX-t.left,y:y.pageY-t.top};var u={xaxis:null,yaxis:null,x2axis:null,y2axis:null,y3axis:null,y4axis:null,y5axis:null,y6axis:null,y7axis:null,y8axis:null,y9axis:null,yMidAxis:null};var v=["xaxis","yaxis","x2axis","y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];var q=x.axes;var r,s;for(r=11;r>0;r--){s=v[r-1];if(q[s].show){u[s]=q[s].series_p2u(w[s.charAt(0)])}}return{offsets:t,gridPos:w,dataPos:u}}function h(z){var x=z.data.plot;var y=x.plugins.cursor;if(y.show&&y.zoom&&y._zoom.started&&!y.zoomTarget){z.preventDefault();var B=y.zoomCanvas._ctx;var v=o(z);var w=v.gridPos;var t=v.dataPos;y._zoom.gridpos=w;y._zoom.datapos=t;y._zoom.zooming=true;var u=w.x;var s=w.y;var A=B.canvas.height;var q=B.canvas.width;if(y.showTooltip&&!y.onGrid&&y.showTooltipOutsideZoom){e(w,t,x);if(y.followMouse){n(w,x)}}if(y.constrainZoomTo=="x"){y._zoom.end=[u,A]}else{if(y.constrainZoomTo=="y"){y._zoom.end=[q,s]}else{y._zoom.end=[u,s]}}var r=window.getSelection;if(document.selection&&document.selection.empty){document.selection.empty()}else{if(r&&!r().isCollapsed){r().collapse()}}l.call(y);B=null}}function a(w,s,r,x,t){var v=t.plugins.cursor;if(t.plugins.mobile){j(document).one("vmouseup.jqplot_cursor",{plot:t},p)}else{j(document).one("mouseup.jqplot_cursor",{plot:t},p)}var u=t.axes;if(document.onselectstart!=undefined){v._oldHandlers.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!=undefined){v._oldHandlers.ondrag=document.ondrag;document.ondrag=function(){return false}}if(document.onmousedown!=undefined){v._oldHandlers.onmousedown=document.onmousedown;document.onmousedown=function(){return false}}if(v.zoom){if(!v.zoomProxy){var y=v.zoomCanvas._ctx;y.clearRect(0,0,y.canvas.width,y.canvas.height);y=null}if(v.constrainZoomTo=="x"){v._zoom.start=[s.x,0]}else{if(v.constrainZoomTo=="y"){v._zoom.start=[0,s.y]}else{v._zoom.start=[s.x,s.y]}}v._zoom.started=true;for(var q in r){v._zoom.axes.start[q]=r[q]}if(t.plugins.mobile){j(document).bind("vmousemove.jqplotCursor",{plot:t},h)}else{j(document).bind("mousemove.jqplotCursor",{plot:t},h)}}}function p(y){var v=y.data.plot;var x=v.plugins.cursor;if(x.zoom&&x._zoom.zooming&&!x.zoomTarget){var u=x._zoom.gridpos.x;var r=x._zoom.gridpos.y;var t=x._zoom.datapos;var z=x.zoomCanvas._ctx.canvas.height;var q=x.zoomCanvas._ctx.canvas.width;var w=v.axes;if(x.constrainOutsideZoom&&!x.onGrid){if(u<0){u=0}else{if(u>q){u=q}}if(r<0){r=0}else{if(r>z){r=z}}for(var s in t){if(t[s]){if(s.charAt(0)=="x"){t[s]=w[s].series_p2u(u)}else{t[s]=w[s].series_p2u(r)}}}}if(x.constrainZoomTo=="x"){r=z}else{if(x.constrainZoomTo=="y"){u=q}}x._zoom.end=[u,r];x._zoom.gridpos={x:u,y:r};x.doZoom(x._zoom.gridpos,t,v,x)}x._zoom.started=false;x._zoom.zooming=false;j(document).unbind("mousemove.jqplotCursor",h);if(document.onselectstart!=undefined&&x._oldHandlers.onselectstart!=null){document.onselectstart=x._oldHandlers.onselectstart;x._oldHandlers.onselectstart=null}if(document.ondrag!=undefined&&x._oldHandlers.ondrag!=null){document.ondrag=x._oldHandlers.ondrag;x._oldHandlers.ondrag=null}if(document.onmousedown!=undefined&&x._oldHandlers.onmousedown!=null){document.onmousedown=x._oldHandlers.onmousedown;x._oldHandlers.onmousedown=null}}function l(){var y=this._zoom.start;var u=this._zoom.end;var s=this.zoomCanvas._ctx;var r,v,x,q;if(u[0]>y[0]){r=y[0];q=u[0]-y[0]}else{r=u[0];q=y[0]-u[0]}if(u[1]>y[1]){v=y[1];x=u[1]-y[1]}else{v=u[1];x=y[1]-u[1]}s.fillStyle="rgba(0,0,0,0.2)";s.strokeStyle="#999999";s.lineWidth=1;s.clearRect(0,0,s.canvas.width,s.canvas.height);s.fillRect(0,0,s.canvas.width,s.canvas.height);s.clearRect(r,v,q,x);s.strokeRect(r,v,q,x);s=null}j.jqplot.CursorLegendRenderer=function(q){j.jqplot.TableLegendRenderer.call(this,q);this.formatString="%s"};j.jqplot.CursorLegendRenderer.prototype=new j.jqplot.TableLegendRenderer();j.jqplot.CursorLegendRenderer.prototype.constructor=j.jqplot.CursorLegendRenderer;j.jqplot.CursorLegendRenderer.prototype.draw=function(){if(this._elem){this._elem.emptyForce();this._elem=null}if(this.show){var w=this._series,A;var r=document.createElement("table");this._elem=j(r);r=null;this._elem.addClass("jqplot-legend jqplot-cursor-legend");this._elem.css("position","absolute");var q=false;for(var x=0;x<w.length;x++){A=w[x];if(A.show&&A.showLabel){var v=j.jqplot.sprintf(this.formatString,A.label.toString());if(v){var t=A.color;if(A._stack&&!A.fill){t=""}z.call(this,v,t,q,x);q=true}for(var u=0;u<j.jqplot.addLegendRowHooks.length;u++){var y=j.jqplot.addLegendRowHooks[u].call(this,A);if(y){z.call(this,y.label,y.color,q);q=true}}}}w=A=null;delete w;delete A}function z(D,C,F,s){var B=(F)?this.rowSpacing:"0";var E=j('<tr class="jqplot-legend jqplot-cursor-legend"></tr>').appendTo(this._elem);E.data("seriesIndex",s);j('<td class="jqplot-legend jqplot-cursor-legend-swatch" style="padding-top:'+B+';"><div style="border:1px solid #cccccc;padding:0.2em;"><div class="jqplot-cursor-legend-swatch" style="background-color:'+C+';"></div></div></td>').appendTo(E);var G=j('<td class="jqplot-legend jqplot-cursor-legend-label" style="vertical-align:middle;padding-top:'+B+';"></td>');G.appendTo(E);G.data("seriesIndex",s);if(this.escapeHtml){G.text(D)}else{G.html(D)}E=null;G=null}return this._elem}})(jQuery);
@@ -0,0 +1,741 @@
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.8
6
+ * Revision: 1250
7
+ *
8
+ * Copyright (c) 2009-2013 Chris Leonello
9
+ * jqPlot is currently available for use in all personal or commercial projects
10
+ * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
11
+ * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
12
+ * choose the license that best suits your project and use it accordingly.
13
+ *
14
+ * Although not required, the author would appreciate an email letting him
15
+ * know of any substantial use of jqPlot. You can reach the author at:
16
+ * chris at jqplot dot com or see http://www.jqplot.com/info.php .
17
+ *
18
+ * If you are feeling kind and generous, consider supporting the project by
19
+ * making a donation at: http://www.jqplot.com/donate.php .
20
+ *
21
+ * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
22
+ *
23
+ * version 2007.04.27
24
+ * author Ash Searle
25
+ * http://hexmen.com/blog/2007/03/printf-sprintf/
26
+ * http://hexmen.com/js/sprintf.js
27
+ * The author (Ash Searle) has placed this code in the public domain:
28
+ * "This code is unrestricted: you are free to use it however you like."
29
+ *
30
+ */
31
+ (function($) {
32
+ /**
33
+ * Class: $.jqplot.DateAxisRenderer
34
+ * A plugin for a jqPlot to render an axis as a series of date values.
35
+ * This renderer has no options beyond those supplied by the <Axis> class.
36
+ * It supplies its own tick formatter, so the tickOptions.formatter option
37
+ * should not be overridden.
38
+ *
39
+ * Thanks to Ken Synder for his enhanced Date instance methods which are
40
+ * included with this code <http://kendsnyder.com/sandbox/date/>.
41
+ *
42
+ * To use this renderer, include the plugin in your source
43
+ * > <script type="text/javascript" language="javascript" src="plugins/jqplot.dateAxisRenderer.js"></script>
44
+ *
45
+ * and supply the appropriate options to your plot
46
+ *
47
+ * > {axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer}}}
48
+ *
49
+ * Dates can be passed into the axis in almost any recognizable value and
50
+ * will be parsed. They will be rendered on the axis in the format
51
+ * specified by tickOptions.formatString. e.g. tickOptions.formatString = '%Y-%m-%d'.
52
+ *
53
+ * Accecptable format codes
54
+ * are:
55
+ *
56
+ * > Code Result Description
57
+ * > == Years ==
58
+ * > %Y 2008 Four-digit year
59
+ * > %y 08 Two-digit year
60
+ * > == Months ==
61
+ * > %m 09 Two-digit month
62
+ * > %#m 9 One or two-digit month
63
+ * > %B September Full month name
64
+ * > %b Sep Abbreviated month name
65
+ * > == Days ==
66
+ * > %d 05 Two-digit day of month
67
+ * > %#d 5 One or two-digit day of month
68
+ * > %e 5 One or two-digit day of month
69
+ * > %A Sunday Full name of the day of the week
70
+ * > %a Sun Abbreviated name of the day of the week
71
+ * > %w 0 Number of the day of the week (0 = Sunday, 6 = Saturday)
72
+ * > %o th The ordinal suffix string following the day of the month
73
+ * > == Hours ==
74
+ * > %H 23 Hours in 24-hour format (two digits)
75
+ * > %#H 3 Hours in 24-hour integer format (one or two digits)
76
+ * > %I 11 Hours in 12-hour format (two digits)
77
+ * > %#I 3 Hours in 12-hour integer format (one or two digits)
78
+ * > %p PM AM or PM
79
+ * > == Minutes ==
80
+ * > %M 09 Minutes (two digits)
81
+ * > %#M 9 Minutes (one or two digits)
82
+ * > == Seconds ==
83
+ * > %S 02 Seconds (two digits)
84
+ * > %#S 2 Seconds (one or two digits)
85
+ * > %s 1206567625723 Unix timestamp (Seconds past 1970-01-01 00:00:00)
86
+ * > == Milliseconds ==
87
+ * > %N 008 Milliseconds (three digits)
88
+ * > %#N 8 Milliseconds (one to three digits)
89
+ * > == Timezone ==
90
+ * > %O 360 difference in minutes between local time and GMT
91
+ * > %Z Mountain Standard Time Name of timezone as reported by browser
92
+ * > %G -06:00 Hours and minutes between GMT
93
+ * > == Shortcuts ==
94
+ * > %F 2008-03-26 %Y-%m-%d
95
+ * > %T 05:06:30 %H:%M:%S
96
+ * > %X 05:06:30 %H:%M:%S
97
+ * > %x 03/26/08 %m/%d/%y
98
+ * > %D 03/26/08 %m/%d/%y
99
+ * > %#c Wed Mar 26 15:31:00 2008 %a %b %e %H:%M:%S %Y
100
+ * > %v 3-Sep-2008 %e-%b-%Y
101
+ * > %R 15:31 %H:%M
102
+ * > %r 3:31:00 PM %I:%M:%S %p
103
+ * > == Characters ==
104
+ * > %n \n Newline
105
+ * > %t \t Tab
106
+ * > %% % Percent Symbol
107
+ */
108
+ $.jqplot.DateAxisRenderer = function() {
109
+ $.jqplot.LinearAxisRenderer.call(this);
110
+ this.date = new $.jsDate();
111
+ };
112
+
113
+ var second = 1000;
114
+ var minute = 60 * second;
115
+ var hour = 60 * minute;
116
+ var day = 24 * hour;
117
+ var week = 7 * day;
118
+
119
+ // these are less definitive
120
+ var month = 30.4368499 * day;
121
+ var year = 365.242199 * day;
122
+
123
+ var daysInMonths = [31,28,31,30,31,30,31,30,31,30,31,30];
124
+ // array of consistent nice intervals. Longer intervals
125
+ // will depend on days in month, days in year, etc.
126
+ var niceFormatStrings = ['%M:%S.%#N', '%M:%S.%#N', '%M:%S.%#N', '%M:%S', '%M:%S', '%M:%S', '%M:%S', '%H:%M:%S', '%H:%M:%S', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%a %H:%M', '%a %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%v', '%v', '%v', '%v', '%v', '%v', '%v'];
127
+ var niceIntervals = [0.1*second, 0.2*second, 0.5*second, second, 2*second, 5*second, 10*second, 15*second, 30*second, minute, 2*minute, 5*minute, 10*minute, 15*minute, 30*minute, hour, 2*hour, 4*hour, 6*hour, 8*hour, 12*hour, day, 2*day, 3*day, 4*day, 5*day, week, 2*week];
128
+
129
+ var niceMonthlyIntervals = [];
130
+
131
+ function bestDateInterval(min, max, titarget) {
132
+ // iterate through niceIntervals to find one closest to titarget
133
+ var badness = Number.MAX_VALUE;
134
+ var temp, bestTi, bestfmt;
135
+ for (var i=0, l=niceIntervals.length; i < l; i++) {
136
+ temp = Math.abs(titarget - niceIntervals[i]);
137
+ if (temp < badness) {
138
+ badness = temp;
139
+ bestTi = niceIntervals[i];
140
+ bestfmt = niceFormatStrings[i];
141
+ }
142
+ }
143
+
144
+ return [bestTi, bestfmt];
145
+ }
146
+
147
+ $.jqplot.DateAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
148
+ $.jqplot.DateAxisRenderer.prototype.constructor = $.jqplot.DateAxisRenderer;
149
+
150
+ $.jqplot.DateTickFormatter = function(format, val) {
151
+ if (!format) {
152
+ format = '%Y/%m/%d';
153
+ }
154
+ return $.jsDate.strftime(val, format);
155
+ };
156
+
157
+ $.jqplot.DateAxisRenderer.prototype.init = function(options){
158
+ // prop: tickRenderer
159
+ // A class of a rendering engine for creating the ticks labels displayed on the plot,
160
+ // See <$.jqplot.AxisTickRenderer>.
161
+ // this.tickRenderer = $.jqplot.AxisTickRenderer;
162
+ // this.labelRenderer = $.jqplot.AxisLabelRenderer;
163
+ this.tickOptions.formatter = $.jqplot.DateTickFormatter;
164
+ // prop: tickInset
165
+ // Controls the amount to inset the first and last ticks from
166
+ // the edges of the grid, in multiples of the tick interval.
167
+ // 0 is no inset, 0.5 is one half a tick interval, 1 is a full
168
+ // tick interval, etc.
169
+ this.tickInset = 0;
170
+ // prop: drawBaseline
171
+ // True to draw the axis baseline.
172
+ this.drawBaseline = true;
173
+ // prop: baselineWidth
174
+ // width of the baseline in pixels.
175
+ this.baselineWidth = null;
176
+ // prop: baselineColor
177
+ // CSS color spec for the baseline.
178
+ this.baselineColor = null;
179
+ this.daTickInterval = null;
180
+ this._daTickInterval = null;
181
+
182
+ $.extend(true, this, options);
183
+
184
+ var db = this._dataBounds,
185
+ stats,
186
+ sum,
187
+ s,
188
+ d,
189
+ pd,
190
+ sd,
191
+ intv;
192
+
193
+ // Go through all the series attached to this axis and find
194
+ // the min/max bounds for this axis.
195
+ for (var i=0; i<this._series.length; i++) {
196
+ stats = {intervals:[], frequencies:{}, sortedIntervals:[], min:null, max:null, mean:null};
197
+ sum = 0;
198
+ s = this._series[i];
199
+ d = s.data;
200
+ pd = s._plotData;
201
+ sd = s._stackData;
202
+ intv = 0;
203
+
204
+ for (var j=0; j<d.length; j++) {
205
+ if (this.name == 'xaxis' || this.name == 'x2axis') {
206
+ d[j][0] = new $.jsDate(d[j][0]).getTime();
207
+ pd[j][0] = new $.jsDate(d[j][0]).getTime();
208
+ sd[j][0] = new $.jsDate(d[j][0]).getTime();
209
+ if ((d[j][0] != null && d[j][0] < db.min) || db.min == null) {
210
+ db.min = d[j][0];
211
+ }
212
+ if ((d[j][0] != null && d[j][0] > db.max) || db.max == null) {
213
+ db.max = d[j][0];
214
+ }
215
+ if (j>0) {
216
+ intv = Math.abs(d[j][0] - d[j-1][0]);
217
+ stats.intervals.push(intv);
218
+ if (stats.frequencies.hasOwnProperty(intv)) {
219
+ stats.frequencies[intv] += 1;
220
+ }
221
+ else {
222
+ stats.frequencies[intv] = 1;
223
+ }
224
+ }
225
+ sum += intv;
226
+
227
+ }
228
+ else {
229
+ d[j][1] = new $.jsDate(d[j][1]).getTime();
230
+ pd[j][1] = new $.jsDate(d[j][1]).getTime();
231
+ sd[j][1] = new $.jsDate(d[j][1]).getTime();
232
+ if ((d[j][1] != null && d[j][1] < db.min) || db.min == null) {
233
+ db.min = d[j][1];
234
+ }
235
+ if ((d[j][1] != null && d[j][1] > db.max) || db.max == null) {
236
+ db.max = d[j][1];
237
+ }
238
+ if (j>0) {
239
+ intv = Math.abs(d[j][1] - d[j-1][1]);
240
+ stats.intervals.push(intv);
241
+ if (stats.frequencies.hasOwnProperty(intv)) {
242
+ stats.frequencies[intv] += 1;
243
+ }
244
+ else {
245
+ stats.frequencies[intv] = 1;
246
+ }
247
+ }
248
+ }
249
+ sum += intv;
250
+ }
251
+
252
+ if (s.renderer.bands) {
253
+ if (s.renderer.bands.hiData.length) {
254
+ var bd = s.renderer.bands.hiData;
255
+ for (var j=0, l=bd.length; j < l; j++) {
256
+ if (this.name === 'xaxis' || this.name === 'x2axis') {
257
+ bd[j][0] = new $.jsDate(bd[j][0]).getTime();
258
+ if ((bd[j][0] != null && bd[j][0] > db.max) || db.max == null) {
259
+ db.max = bd[j][0];
260
+ }
261
+ }
262
+ else {
263
+ bd[j][1] = new $.jsDate(bd[j][1]).getTime();
264
+ if ((bd[j][1] != null && bd[j][1] > db.max) || db.max == null) {
265
+ db.max = bd[j][1];
266
+ }
267
+ }
268
+ }
269
+ }
270
+ if (s.renderer.bands.lowData.length) {
271
+ var bd = s.renderer.bands.lowData;
272
+ for (var j=0, l=bd.length; j < l; j++) {
273
+ if (this.name === 'xaxis' || this.name === 'x2axis') {
274
+ bd[j][0] = new $.jsDate(bd[j][0]).getTime();
275
+ if ((bd[j][0] != null && bd[j][0] < db.min) || db.min == null) {
276
+ db.min = bd[j][0];
277
+ }
278
+ }
279
+ else {
280
+ bd[j][1] = new $.jsDate(bd[j][1]).getTime();
281
+ if ((bd[j][1] != null && bd[j][1] < db.min) || db.min == null) {
282
+ db.min = bd[j][1];
283
+ }
284
+ }
285
+ }
286
+ }
287
+ }
288
+
289
+ var tempf = 0,
290
+ tempn=0;
291
+ for (var n in stats.frequencies) {
292
+ stats.sortedIntervals.push({interval:n, frequency:stats.frequencies[n]});
293
+ }
294
+ stats.sortedIntervals.sort(function(a, b){
295
+ return b.frequency - a.frequency;
296
+ });
297
+
298
+ stats.min = $.jqplot.arrayMin(stats.intervals);
299
+ stats.max = $.jqplot.arrayMax(stats.intervals);
300
+ stats.mean = sum/d.length;
301
+ this._intervalStats.push(stats);
302
+ stats = sum = s = d = pd = sd = null;
303
+ }
304
+ db = null;
305
+
306
+ };
307
+
308
+ // called with scope of an axis
309
+ $.jqplot.DateAxisRenderer.prototype.reset = function() {
310
+ this.min = this._options.min;
311
+ this.max = this._options.max;
312
+ this.tickInterval = this._options.tickInterval;
313
+ this.numberTicks = this._options.numberTicks;
314
+ this._autoFormatString = '';
315
+ if (this._overrideFormatString && this.tickOptions && this.tickOptions.formatString) {
316
+ this.tickOptions.formatString = '';
317
+ }
318
+ this.daTickInterval = this._daTickInterval;
319
+ // this._ticks = this.__ticks;
320
+ };
321
+
322
+ $.jqplot.DateAxisRenderer.prototype.createTicks = function(plot) {
323
+ // we're are operating on an axis here
324
+ var ticks = this._ticks;
325
+ var userTicks = this.ticks;
326
+ var name = this.name;
327
+ // databounds were set on axis initialization.
328
+ var db = this._dataBounds;
329
+ var iv = this._intervalStats;
330
+ var dim = (this.name.charAt(0) === 'x') ? this._plotDimensions.width : this._plotDimensions.height;
331
+ var interval;
332
+ var min, max;
333
+ var pos1, pos2;
334
+ var tt, i;
335
+ var threshold = 30;
336
+ var insetMult = 1;
337
+ var daTickInterval = null;
338
+
339
+ // if user specified a tick interval, convert to usable.
340
+ if (this.tickInterval != null)
341
+ {
342
+ // if interval is a number or can be converted to one, use it.
343
+ // Assume it is in SECONDS!!!
344
+ if (Number(this.tickInterval)) {
345
+ daTickInterval = [Number(this.tickInterval), 'seconds'];
346
+ }
347
+ // else, parse out something we can build from.
348
+ else if (typeof this.tickInterval == "string") {
349
+ var parts = this.tickInterval.split(' ');
350
+ if (parts.length == 1) {
351
+ daTickInterval = [1, parts[0]];
352
+ }
353
+ else if (parts.length == 2) {
354
+ daTickInterval = [parts[0], parts[1]];
355
+ }
356
+ }
357
+ }
358
+
359
+ var tickInterval = this.tickInterval;
360
+
361
+ // if we already have ticks, use them.
362
+ // ticks must be in order of increasing value.
363
+
364
+ min = new $.jsDate((this.min != null) ? this.min : db.min).getTime();
365
+ max = new $.jsDate((this.max != null) ? this.max : db.max).getTime();
366
+
367
+ // see if we're zooming. if we are, don't use the min and max we're given,
368
+ // but compute some nice ones. They will be reset later.
369
+
370
+ var cursor = plot.plugins.cursor;
371
+
372
+ if (cursor && cursor._zoom && cursor._zoom.zooming) {
373
+ this.min = null;
374
+ this.max = null;
375
+ }
376
+
377
+ var range = max - min;
378
+
379
+ if (this.tickOptions == null || !this.tickOptions.formatString) {
380
+ this._overrideFormatString = true;
381
+ }
382
+
383
+ if (userTicks.length) {
384
+ // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
385
+ for (i=0; i<userTicks.length; i++){
386
+ var ut = userTicks[i];
387
+ var t = new this.tickRenderer(this.tickOptions);
388
+ if (ut.constructor == Array) {
389
+ t.value = new $.jsDate(ut[0]).getTime();
390
+ t.label = ut[1];
391
+ if (!this.showTicks) {
392
+ t.showLabel = false;
393
+ t.showMark = false;
394
+ }
395
+ else if (!this.showTickMarks) {
396
+ t.showMark = false;
397
+ }
398
+ t.setTick(t.value, this.name);
399
+ this._ticks.push(t);
400
+ }
401
+
402
+ else {
403
+ t.value = new $.jsDate(ut).getTime();
404
+ if (!this.showTicks) {
405
+ t.showLabel = false;
406
+ t.showMark = false;
407
+ }
408
+ else if (!this.showTickMarks) {
409
+ t.showMark = false;
410
+ }
411
+ t.setTick(t.value, this.name);
412
+ this._ticks.push(t);
413
+ }
414
+ }
415
+ this.numberTicks = userTicks.length;
416
+ this.min = this._ticks[0].value;
417
+ this.max = this._ticks[this.numberTicks-1].value;
418
+ this.daTickInterval = [(this.max - this.min) / (this.numberTicks - 1)/1000, 'seconds'];
419
+ }
420
+
421
+ ////////
422
+ // We don't have any ticks yet, let's make some!
423
+ ////////
424
+
425
+ // special case when there is only one point, make three tick marks to center the point
426
+ else if (this.min == null && this.max == null && db.min == db.max)
427
+ {
428
+ var onePointOpts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
429
+ var delta = 300000;
430
+ this.min = db.min - delta;
431
+ this.max = db.max + delta;
432
+ this.numberTicks = 3;
433
+
434
+ for(var i=this.min;i<=this.max;i+= delta)
435
+ {
436
+ onePointOpts.value = i;
437
+
438
+ var t = new this.tickRenderer(onePointOpts);
439
+
440
+ if (this._overrideFormatString && this._autoFormatString != '') {
441
+ t.formatString = this._autoFormatString;
442
+ }
443
+
444
+ t.showLabel = false;
445
+ t.showMark = false;
446
+
447
+ this._ticks.push(t);
448
+ }
449
+
450
+ if(this.showTicks) {
451
+ this._ticks[1].showLabel = true;
452
+ }
453
+ if(this.showTickMarks) {
454
+ this._ticks[1].showTickMarks = true;
455
+ }
456
+ }
457
+ // if user specified min and max are null, we set those to make best ticks.
458
+ else if (this.min == null && this.max == null) {
459
+
460
+ var opts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
461
+
462
+ // want to find a nice interval
463
+ var nttarget,
464
+ titarget;
465
+
466
+ // if no tickInterval or numberTicks options specified, make a good guess.
467
+ if (!this.tickInterval && !this.numberTicks) {
468
+ var tdim = Math.max(dim, threshold+1);
469
+ // how many ticks to put on the axis?
470
+ // date labels tend to be long. If ticks not rotated,
471
+ // don't use too many and have a high spacing factor.
472
+ // If we are rotating ticks, use a lower factor.
473
+ var spacingFactor = 115;
474
+ if (this.tickRenderer === $.jqplot.CanvasAxisTickRenderer && this.tickOptions.angle) {
475
+ spacingFactor = 115 - 40 * Math.abs(Math.sin(this.tickOptions.angle/180*Math.PI));
476
+ }
477
+
478
+ nttarget = Math.ceil((tdim-threshold)/spacingFactor + 1);
479
+ titarget = (max - min) / (nttarget - 1);
480
+ }
481
+
482
+ // If tickInterval is specified, we'll try to honor it.
483
+ // Not guaranteed to get this interval, but we'll get as close as
484
+ // we can.
485
+ // tickInterval will be used before numberTicks, that is if
486
+ // both are specified, numberTicks will be ignored.
487
+ else if (this.tickInterval) {
488
+ titarget = new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime();
489
+ }
490
+
491
+ // if numberTicks specified, try to honor it.
492
+ // Not guaranteed, but will try to get close.
493
+ else if (this.numberTicks) {
494
+ nttarget = this.numberTicks;
495
+ titarget = (max - min) / (nttarget - 1);
496
+ }
497
+
498
+ // If we can use an interval of 2 weeks or less, pick best one
499
+ if (titarget <= 19*day) {
500
+ var ret = bestDateInterval(min, max, titarget);
501
+ var tempti = ret[0];
502
+ this._autoFormatString = ret[1];
503
+
504
+ min = new $.jsDate(min);
505
+ min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();
506
+
507
+ nttarget = Math.ceil((max - min) / tempti) + 1;
508
+ this.min = min;
509
+ this.max = min + (nttarget - 1) * tempti;
510
+
511
+ // if max is less than max, add an interval
512
+ if (this.max < max) {
513
+ this.max += tempti;
514
+ nttarget += 1;
515
+ }
516
+ this.tickInterval = tempti;
517
+ this.numberTicks = nttarget;
518
+
519
+ for (var i=0; i<nttarget; i++) {
520
+ opts.value = this.min + i * tempti;
521
+ t = new this.tickRenderer(opts);
522
+
523
+ if (this._overrideFormatString && this._autoFormatString != '') {
524
+ t.formatString = this._autoFormatString;
525
+ }
526
+ if (!this.showTicks) {
527
+ t.showLabel = false;
528
+ t.showMark = false;
529
+ }
530
+ else if (!this.showTickMarks) {
531
+ t.showMark = false;
532
+ }
533
+ this._ticks.push(t);
534
+ }
535
+
536
+ insetMult = this.tickInterval;
537
+ }
538
+
539
+ // should we use a monthly interval?
540
+ else if (titarget <= 9 * month) {
541
+
542
+ this._autoFormatString = '%v';
543
+
544
+ // how many months in an interval?
545
+ var intv = Math.round(titarget/month);
546
+ if (intv < 1) {
547
+ intv = 1;
548
+ }
549
+ else if (intv > 6) {
550
+ intv = 6;
551
+ }
552
+
553
+ // figure out the starting month and ending month.
554
+ var mstart = new $.jsDate(min).setDate(1).setHours(0,0,0,0);
555
+
556
+ // See if max ends exactly on a month
557
+ var tempmend = new $.jsDate(max);
558
+ var mend = new $.jsDate(max).setDate(1).setHours(0,0,0,0);
559
+
560
+ if (tempmend.getTime() !== mend.getTime()) {
561
+ mend = mend.add(1, 'month');
562
+ }
563
+
564
+ var nmonths = mend.diff(mstart, 'month');
565
+
566
+ nttarget = Math.ceil(nmonths/intv) + 1;
567
+
568
+ this.min = mstart.getTime();
569
+ this.max = mstart.clone().add((nttarget - 1) * intv, 'month').getTime();
570
+ this.numberTicks = nttarget;
571
+
572
+ for (var i=0; i<nttarget; i++) {
573
+ if (i === 0) {
574
+ opts.value = mstart.getTime();
575
+ }
576
+ else {
577
+ opts.value = mstart.add(intv, 'month').getTime();
578
+ }
579
+ t = new this.tickRenderer(opts);
580
+
581
+ if (this._overrideFormatString && this._autoFormatString != '') {
582
+ t.formatString = this._autoFormatString;
583
+ }
584
+ if (!this.showTicks) {
585
+ t.showLabel = false;
586
+ t.showMark = false;
587
+ }
588
+ else if (!this.showTickMarks) {
589
+ t.showMark = false;
590
+ }
591
+ this._ticks.push(t);
592
+ }
593
+
594
+ insetMult = intv * month;
595
+ }
596
+
597
+ // use yearly intervals
598
+ else {
599
+
600
+ this._autoFormatString = '%v';
601
+
602
+ // how many years in an interval?
603
+ var intv = Math.round(titarget/year);
604
+ if (intv < 1) {
605
+ intv = 1;
606
+ }
607
+
608
+ // figure out the starting and ending years.
609
+ var mstart = new $.jsDate(min).setMonth(0, 1).setHours(0,0,0,0);
610
+ var mend = new $.jsDate(max).add(1, 'year').setMonth(0, 1).setHours(0,0,0,0);
611
+
612
+ var nyears = mend.diff(mstart, 'year');
613
+
614
+ nttarget = Math.ceil(nyears/intv) + 1;
615
+
616
+ this.min = mstart.getTime();
617
+ this.max = mstart.clone().add((nttarget - 1) * intv, 'year').getTime();
618
+ this.numberTicks = nttarget;
619
+
620
+ for (var i=0; i<nttarget; i++) {
621
+ if (i === 0) {
622
+ opts.value = mstart.getTime();
623
+ }
624
+ else {
625
+ opts.value = mstart.add(intv, 'year').getTime();
626
+ }
627
+ t = new this.tickRenderer(opts);
628
+
629
+ if (this._overrideFormatString && this._autoFormatString != '') {
630
+ t.formatString = this._autoFormatString;
631
+ }
632
+ if (!this.showTicks) {
633
+ t.showLabel = false;
634
+ t.showMark = false;
635
+ }
636
+ else if (!this.showTickMarks) {
637
+ t.showMark = false;
638
+ }
639
+ this._ticks.push(t);
640
+ }
641
+
642
+ insetMult = intv * year;
643
+ }
644
+ }
645
+
646
+ ////////
647
+ // Some option(s) specified, work around that.
648
+ ////////
649
+
650
+ else {
651
+ if (name == 'xaxis' || name == 'x2axis') {
652
+ dim = this._plotDimensions.width;
653
+ }
654
+ else {
655
+ dim = this._plotDimensions.height;
656
+ }
657
+
658
+ // if min, max and number of ticks specified, user can't specify interval.
659
+ if (this.min != null && this.max != null && this.numberTicks != null) {
660
+ this.tickInterval = null;
661
+ }
662
+
663
+ if (this.tickInterval != null && daTickInterval != null) {
664
+ this.daTickInterval = daTickInterval;
665
+ }
666
+
667
+ // if min and max are same, space them out a bit
668
+ if (min == max) {
669
+ var adj = 24*60*60*500; // 1/2 day
670
+ min -= adj;
671
+ max += adj;
672
+ }
673
+
674
+ range = max - min;
675
+
676
+ var optNumTicks = 2 + parseInt(Math.max(0, dim-100)/100, 10);
677
+
678
+
679
+ var rmin, rmax;
680
+
681
+ rmin = (this.min != null) ? new $.jsDate(this.min).getTime() : min - range/2*(this.padMin - 1);
682
+ rmax = (this.max != null) ? new $.jsDate(this.max).getTime() : max + range/2*(this.padMax - 1);
683
+ this.min = rmin;
684
+ this.max = rmax;
685
+ range = this.max - this.min;
686
+
687
+ if (this.numberTicks == null){
688
+ // if tickInterval is specified by user, we will ignore computed maximum.
689
+ // max will be equal or greater to fit even # of ticks.
690
+ if (this.daTickInterval != null) {
691
+ var nc = new $.jsDate(this.max).diff(this.min, this.daTickInterval[1], true);
692
+ this.numberTicks = Math.ceil(nc/this.daTickInterval[0]) +1;
693
+ // this.max = new $.jsDate(this.min).add(this.numberTicks-1, this.daTickInterval[1]).getTime();
694
+ this.max = new $.jsDate(this.min).add((this.numberTicks-1) * this.daTickInterval[0], this.daTickInterval[1]).getTime();
695
+ }
696
+ else if (dim > 200) {
697
+ this.numberTicks = parseInt(3+(dim-200)/100, 10);
698
+ }
699
+ else {
700
+ this.numberTicks = 2;
701
+ }
702
+ }
703
+
704
+ insetMult = range / (this.numberTicks-1)/1000;
705
+
706
+ if (this.daTickInterval == null) {
707
+ this.daTickInterval = [insetMult, 'seconds'];
708
+ }
709
+
710
+
711
+ for (var i=0; i<this.numberTicks; i++){
712
+ var min = new $.jsDate(this.min);
713
+ tt = min.add(i*this.daTickInterval[0], this.daTickInterval[1]).getTime();
714
+ var t = new this.tickRenderer(this.tickOptions);
715
+ // var t = new $.jqplot.AxisTickRenderer(this.tickOptions);
716
+ if (!this.showTicks) {
717
+ t.showLabel = false;
718
+ t.showMark = false;
719
+ }
720
+ else if (!this.showTickMarks) {
721
+ t.showMark = false;
722
+ }
723
+ t.setTick(tt, this.name);
724
+ this._ticks.push(t);
725
+ }
726
+ }
727
+
728
+ if (this.tickInset) {
729
+ this.min = this.min - this.tickInset * insetMult;
730
+ this.max = this.max + this.tickInset * insetMult;
731
+ }
732
+
733
+ if (this._daTickInterval == null) {
734
+ this._daTickInterval = this.daTickInterval;
735
+ }
736
+
737
+ ticks = null;
738
+ };
739
+
740
+ })(jQuery);
741
+