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(e){e.jqplot.PyramidAxisRenderer=function(){e.jqplot.LinearAxisRenderer.call(this)};e.jqplot.PyramidAxisRenderer.prototype=new e.jqplot.LinearAxisRenderer();e.jqplot.PyramidAxisRenderer.prototype.constructor=e.jqplot.PyramidAxisRenderer;e.jqplot.PyramidAxisRenderer.prototype.init=function(f){this.position=null;this.drawBaseline=true;this.baselineWidth=null;this.baselineColor=null;this.tickSpacingFactor=25;this._type="pyramid";this._splitAxis=false;this._splitLength=null;this.category=false;this._autoFormatString="";this._overrideFormatString=false;e.extend(true,this,f);this.renderer.options=f;this.resetDataBounds=this.renderer.resetDataBounds;this.resetDataBounds()};e.jqplot.PyramidAxisRenderer.prototype.resetDataBounds=function(){var h=this._dataBounds;h.min=null;h.max=null;var g;for(var m=0;m<this._series.length;m++){var n=this._series[m];var o=n._plotData;for(var k=0,f=o.length;k<f;k++){if(this.name.charAt(0)==="x"){g=o[k][1];if((g!==null&&g<h.min)||h.min===null){h.min=g}if((g!==null&&g>h.max)||h.max===null){h.max=g}}else{g=o[k][0];if((g!==null&&g<h.min)||h.min===null){h.min=g}if((g!==null&&g>h.max)||h.max===null){h.max=g}}}}};e.jqplot.PyramidAxisRenderer.prototype.draw=function(f,n){if(this.show){this.renderer.createTicks.call(this,n);var m=0;var g;if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=e(document.createElement("div"));this._elem.addClass("jqplot-axis jqplot-"+this.name);this._elem.css("position","absolute");if(this.name=="xaxis"||this.name=="x2axis"){this._elem.width(this._plotDimensions.width)}else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis=this.name;this._label=new this.labelRenderer(this.labelOptions);if(this._label.show){var l=this._label.draw(f,n);l.appendTo(this._elem);l=null}var k=this._ticks;var j;for(var h=0;h<k.length;h++){j=k[h];if(j.show&&j.showLabel&&(!j.isMinorTick)){this._elem.append(j.draw(f,n))}}j=null;k=null}return this._elem};var b=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var d={};for(var c=0,a=b.length;c<a;c++){d[b[c]]=b[c]}e.jqplot.PyramidAxisRenderer.prototype.createTicks=function(D){var J=this.ticks;var M=this._dataBounds;var E;var K;var B;var G;var y;var n;var k;var h;var H;var C;var x;var L=this.min;var N=this.max;var q;var v;var m;var g;var j;var O;var A;var F;var r;var P;var z=null;var I;if(J.length){for(H=0,C=J.length;H<C;H++){q=J[H];v=new this.tickRenderer(this.tickOptions);if(e.isArray(q)){v.value=q[0];v.label=q[1];v.setTick(q[0],this.name);this._ticks.push(v)}else{if(e.isPlainObject(q)){e.extend(true,v,q);v.axis=this.name;this._ticks.push(v)}else{if(typeof q==="string"){P=H+D.defaultAxisStart}else{P=q}v.value=P;v.label=q;v.axis=this.name;this._ticks.push(v)}}}this.numberTicks=J.length;this.min=this._ticks[0].value;this.max=this._ticks[this.numberTicks-1].value;this.tickInterval=(this.max-this.min)/(this.numberTicks-1);if(this._options.tickInterval){var o=this._options.tickInterval;for(H=0;H<this.numberTicks;H++){if(H%o!==0){this._ticks[H].isMinorTick=true}}}else{E=(this.name.charAt(0)==="x")?this._plotDimensions.width:this._plotDimensions.height;r=Math.round(2+E/this.tickSpacingFactor);if(this.numberTicks>r){I=this.numberTicks-1;for(H=2;H<I;H++){if(I%H===0&&I/H<r){z=H-1;break}}if(z!==null){var p=1;for(H=1,C=this._ticks.length;H<C;H++){if(p<=z){this._ticks[H].show=false;p+=1}else{p=1}}}}}I=[];if(this.category){this._ticks[0].showGridline=false;this._ticks[0].showMark=false;for(H=this._ticks.length-1;H>0;H--){v=new this.tickRenderer(this.tickOptions);v.value=this._ticks[H-1].value+this.tickInterval/2;v.label="";v.showLabel=false;v.axis=this.name;this._ticks[H].showGridline=false;this._ticks[H].showMark=false;this._ticks.splice(H,0,v)}v=new this.tickRenderer(this.tickOptions);v.value=this._ticks[0].value-this.tickInterval/2;v.label="";v.showLabel=false;v.axis=this.name;this._ticks.unshift(v);v=new this.tickRenderer(this.tickOptions);v.value=this._ticks[this._ticks.length-1].value+this.tickInterval/2;v.label="";v.showLabel=false;v.axis=this.name;this._ticks.push(v);this.tickInterval=this.tickInterval/2;this.numberTicks=this._ticks.length;this.min=this._ticks[0].value;this.max=this._ticks[this._ticks.length-1].value}}else{if(this.name.charAt(0)==="x"){E=this._plotDimensions.width;var w=Math.max(M.max,Math.abs(M.min));var u=Math.min(M.min,-w);B=u;G=w;y=G-B;if(this.tickOptions==null||!this.tickOptions.formatString){this._overrideFormatString=true}m=30;g=Math.max(E,m+1);j=(g-m)/300;O=e.jqplot.LinearTickGenerator(B,G,j);A=B+y*(this.padMin-1);F=G-y*(this.padMax-1);if(B<A||G>F){A=B-y*(this.padMin-1);F=G+y*(this.padMax-1);O=e.jqplot.LinearTickGenerator(A,F,j)}this.min=O[0];this.max=O[1];this.numberTicks=O[2];this._autoFormatString=O[3];this.tickInterval=O[4]}else{E=this._plotDimensions.height;B=M.min;G=M.max;x=this._series[0];this._ticks=[];y=G-B;if(d[y]){y+=1;G+=1}this.max=G;this.min=B;r=Math.round(2+E/this.tickSpacingFactor);if(y+1<=r){this.numberTicks=y+1;this.tickInterval=1}else{for(var H=r;H>1;H--){if(y/(H-1)===Math.round(y/(H-1))){this.numberTicks=H;this.tickInterval=y/(H-1);break}}}}if(this._overrideFormatString&&this._autoFormatString!=""){this.tickOptions=this.tickOptions||{};this.tickOptions.formatString=this._autoFormatString}var f;for(H=0;H<this.numberTicks;H++){this.tickOptions.axis=this.name;f=this.min+this.tickInterval*H;if(this.name.charAt(0)==="x"){f=Math.abs(f)}this.tickOptions.value=this.min+this.tickInterval*H;v=new this.tickRenderer(this.tickOptions);v.label=v.prefix+v.formatter(v.formatString,f);this._ticks.push(v);if(this.name.charAt(0)==="x"&&D.axes.yMidAxis.show&&this.tickOptions.value===0){this._splitAxis=true;this._splitLength=D.axes.yMidAxis.getWidth();v=new this.tickRenderer(this.tickOptions);this._ticks.push(v);v.value=this.max/2000}}v=null}};e.jqplot.PyramidAxisRenderer.prototype.set=function(){var o=0;var j;var g=0;var n=0;var m;var l;var k;var f=(this._label==null)?false:this._label.show;if(this.show){l=this._ticks;a=l.length;for(m=0;m<a;m++){k=l[m];if(!k._breakTick&&k.show&&k.showLabel&&!k.isMinorTick){if(this.name.charAt(0)==="x"){j=k._elem.outerHeight(true)}else{j=k._elem.outerWidth(true)}if(j>o){o=j}}}if(this.name==="yMidAxis"){for(m=0;m<a;m++){k=l[m];if(k._elem){j=(o-k._elem.outerWidth(true))/2;k._elem.css("left",j)}}}k=null;l=null;if(f){g=this._label._elem.outerWidth(true);n=this._label._elem.outerHeight(true)}if(this.name==="xaxis"){o=o+n;this._elem.css({height:o+"px",left:"0px",bottom:"0px"})}else{if(this.name==="x2axis"){o=o+n;this._elem.css({height:o+"px",left:"0px",top:"0px"})}else{if(this.name==="yaxis"){o=o+g;this._elem.css({width:o+"px",left:"0px",top:"0px"});if(f&&this._label.constructor==e.jqplot.AxisLabelRenderer){this._label._elem.css("width",g+"px")}}else{if(this.name==="yMidAxis"){var j=o/2-g/2;this._elem.css({width:o+"px",top:"0px"});if(f&&this._label.constructor==e.jqplot.AxisLabelRenderer){this._label._elem.css({width:g,left:j,top:0})}}else{o=o+g;this._elem.css({width:o+"px",right:"0px",top:"0px"});if(f&&this._label.constructor==e.jqplot.AxisLabelRenderer){this._label._elem.css("width",g+"px")}}}}}}};e.jqplot.PyramidAxisRenderer.prototype.pack=function(j,g){j=j||{};g=g||this._offsets;var B=this._ticks;var v=this.max;var u=this.min;var o=g.max;var m=g.min;var r=(this._label==null)?false:this._label.show;for(var s in j){this._elem.css(s,j[s])}this._offsets=g;var k=o-m;var l=v-u;var z=this._splitLength;if(this._splitAxis){k-=this._splitLength;this.p2u=function(h){return(h-m)*l/k+u};this.u2p=function(h){if(h<=0){return(h-u)*k/l+m}else{return(h-u)*k/l+m+z}};this.series_u2p=function(h){if(h<=0){return(h-u)*k/l}else{return(h-u)*k/l+z}};this.series_p2u=function(h){return h*l/k+u}}else{this.p2u=function(h){return(h-m)*l/k+u};this.u2p=function(h){return(h-u)*k/l+m};if(this.name.charAt(0)==="x"){this.series_u2p=function(h){return(h-u)*k/l};this.series_p2u=function(h){return h*l/k+u}}else{this.series_u2p=function(h){return(h-v)*k/l};this.series_p2u=function(h){return h*l/k+v}}}if(this.show){if(this.name.charAt(0)==="x"){for(var x=0;x<B.length;x++){var q=B[x];if(q.show&&q.showLabel){var f;if(q.constructor==e.jqplot.CanvasAxisTickRenderer&&q.angle){var A=(this.name=="xaxis")?1:-1;switch(q.labelPosition){case"auto":if(A*q.angle<0){f=-q.getWidth()+q._textRenderer.height*Math.sin(-q._textRenderer.angle)/2}else{f=-q._textRenderer.height*Math.sin(q._textRenderer.angle)/2}break;case"end":f=-q.getWidth()+q._textRenderer.height*Math.sin(-q._textRenderer.angle)/2;break;case"start":f=-q._textRenderer.height*Math.sin(q._textRenderer.angle)/2;break;case"middle":f=-q.getWidth()/2+q._textRenderer.height*Math.sin(-q._textRenderer.angle)/2;break;default:f=-q.getWidth()/2+q._textRenderer.height*Math.sin(-q._textRenderer.angle)/2;break}}else{f=-q.getWidth()/2}var C=this.u2p(q.value)+f+"px";q._elem.css("left",C);q.pack()}}if(r){var n=this._label._elem.outerWidth(true);this._label._elem.css("left",m+k/2-n/2+"px");if(this.name=="xaxis"){this._label._elem.css("bottom","0px")}else{this._label._elem.css("top","0px")}this._label.pack()}}else{for(var x=0;x<B.length;x++){var q=B[x];if(q.show&&q.showLabel&&!q.isMinorTick){var f;if(q.constructor==e.jqplot.CanvasAxisTickRenderer&&q.angle){var A=(this.name=="yaxis")?1:-1;switch(q.labelPosition){case"auto":case"end":if(A*q.angle<0){f=-q._textRenderer.height*Math.cos(-q._textRenderer.angle)/2}else{f=-q.getHeight()+q._textRenderer.height*Math.cos(q._textRenderer.angle)/2}break;case"start":if(q.angle>0){f=-q._textRenderer.height*Math.cos(-q._textRenderer.angle)/2}else{f=-q.getHeight()+q._textRenderer.height*Math.cos(q._textRenderer.angle)/2}break;case"middle":f=-q.getHeight()/2;break;default:f=-q.getHeight()/2;break}}else{f=-q.getHeight()/2}var C=this.u2p(q.value)+f+"px";q._elem.css("top",C);q.pack()}}if(r){var y=this._label._elem.outerHeight(true);if(this.name!=="yMidAxis"){this._label._elem.css("top",o-k/2-y/2+"px")}if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{if(this.name!=="yMidAxis"){this._label._elem.css("right","0px")}}this._label.pack()}}}B=null}})(jQuery);
@@ -0,0 +1,429 @@
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
+ // Class: $.jqplot.CanvasGridRenderer
33
+ // The default jqPlot grid renderer, creating a grid on a canvas element.
34
+ // The renderer has no additional options beyond the <Grid> class.
35
+ $.jqplot.PyramidGridRenderer = function(){
36
+ $.jqplot.CanvasGridRenderer.call(this);
37
+ };
38
+
39
+ $.jqplot.PyramidGridRenderer.prototype = new $.jqplot.CanvasGridRenderer();
40
+ $.jqplot.PyramidGridRenderer.prototype.constructor = $.jqplot.PyramidGridRenderer;
41
+
42
+ // called with context of Grid object
43
+ $.jqplot.CanvasGridRenderer.prototype.init = function(options) {
44
+ this._ctx;
45
+ this.plotBands = {
46
+ show: false,
47
+ color: 'rgb(230, 219, 179)',
48
+ axis: 'y',
49
+ start: null,
50
+ interval: 10
51
+ };
52
+ $.extend(true, this, options);
53
+ // set the shadow renderer options
54
+ var sopts = {lineJoin:'miter', lineCap:'round', fill:false, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.shadowWidth, closePath:false, strokeStyle:this.shadowColor};
55
+ this.renderer.shadowRenderer.init(sopts);
56
+ };
57
+
58
+ $.jqplot.PyramidGridRenderer.prototype.draw = function() {
59
+ this._ctx = this._elem.get(0).getContext("2d");
60
+ var ctx = this._ctx;
61
+ var axes = this._axes;
62
+ var xp = axes.xaxis.u2p;
63
+ var yp = axes.yMidAxis.u2p;
64
+ var xnudge = axes.xaxis.max/1000.0;
65
+ var xp0 = xp(0);
66
+ var xpn = xp(xnudge);
67
+ var ax = ['xaxis', 'yaxis', 'x2axis', 'y2axis','yMidAxis'];
68
+ // Add the grid onto the grid canvas. This is the bottom most layer.
69
+ ctx.save();
70
+ ctx.clearRect(0, 0, this._plotDimensions.width, this._plotDimensions.height);
71
+ ctx.fillStyle = this.backgroundColor || this.background;
72
+
73
+ ctx.fillRect(this._left, this._top, this._width, this._height);
74
+
75
+ if (this.plotBands.show) {
76
+ ctx.save();
77
+ var pb = this.plotBands;
78
+ ctx.fillStyle = pb.color;
79
+ var axis;
80
+ var x, y, w, h;
81
+ // find axis to work with
82
+ if (pb.axis.charAt(0) === 'x') {
83
+ if (axes.xaxis.show) {
84
+ axis = axes.xaxis;
85
+ }
86
+ }
87
+ else if (pb.axis.charAt(0) === 'y') {
88
+ if (axes.yaxis.show) {
89
+ axis = axes.yaxis;
90
+ }
91
+ else if (axes.y2axis.show) {
92
+ axis = axes.y2axis;
93
+ }
94
+ else if (axes.yMidAxis.show) {
95
+ axis = axes.yMidAxis;
96
+ }
97
+ }
98
+
99
+ if (axis !== undefined) {
100
+ // draw some rectangles
101
+ var start = pb.start;
102
+ if (start === null) {
103
+ start = axis.min;
104
+ }
105
+ for (var i = start; i < axis.max; i += 2 * pb.interval) {
106
+ if (axis.name.charAt(0) === 'y') {
107
+ x = this._left;
108
+ if ((i + pb.interval) < axis.max) {
109
+ y = axis.series_u2p(i + pb.interval) + this._top;
110
+ }
111
+ else {
112
+ y = axis.series_u2p(axis.max) + this._top;
113
+ }
114
+ w = this._right - this._left;
115
+ h = axis.series_u2p(start) - axis.series_u2p(start + pb.interval);
116
+ ctx.fillRect(x, y, w, h);
117
+ }
118
+ // else {
119
+ // y = 0;
120
+ // x = axis.series_u2p(i);
121
+ // h = this._height;
122
+ // w = axis.series_u2p(start + pb.interval) - axis.series_u2p(start);
123
+ // }
124
+
125
+ }
126
+ }
127
+ ctx.restore();
128
+ }
129
+
130
+ ctx.save();
131
+ ctx.lineJoin = 'miter';
132
+ ctx.lineCap = 'butt';
133
+ ctx.lineWidth = this.gridLineWidth;
134
+ ctx.strokeStyle = this.gridLineColor;
135
+ var b, e, s, m;
136
+ for (var i=5; i>0; i--) {
137
+ var name = ax[i-1];
138
+ var axis = axes[name];
139
+ var ticks = axis._ticks;
140
+ var numticks = ticks.length;
141
+ if (axis.show) {
142
+ if (axis.drawBaseline) {
143
+ var bopts = {};
144
+ if (axis.baselineWidth !== null) {
145
+ bopts.lineWidth = axis.baselineWidth;
146
+ }
147
+ if (axis.baselineColor !== null) {
148
+ bopts.strokeStyle = axis.baselineColor;
149
+ }
150
+ switch (name) {
151
+ case 'xaxis':
152
+ if (axes.yMidAxis.show) {
153
+ drawLine (this._left, this._bottom, xp0, this._bottom, bopts);
154
+ drawLine (xpn, this._bottom, this._right, this._bottom, bopts);
155
+ }
156
+ else {
157
+ drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
158
+ }
159
+ break;
160
+ case 'yaxis':
161
+ drawLine (this._left, this._bottom, this._left, this._top, bopts);
162
+ break;
163
+ case 'yMidAxis':
164
+ drawLine(xp0, this._bottom, xp0, this._top, bopts);
165
+ drawLine(xpn, this._bottom, xpn, this._top, bopts);
166
+ break;
167
+ case 'x2axis':
168
+ if (axes.yMidAxis.show) {
169
+ drawLine (this._left, this._top, xp0, this._top, bopts);
170
+ drawLine (xpn, this._top, this._right, this._top, bopts);
171
+ }
172
+ else {
173
+ drawLine (this._left, this._bottom, this._right, this._bottom, bopts);
174
+ }
175
+ break;
176
+ case 'y2axis':
177
+ drawLine (this._right, this._bottom, this._right, this._top, bopts);
178
+ break;
179
+
180
+ }
181
+ }
182
+ for (var j=numticks; j>0; j--) {
183
+ var t = ticks[j-1];
184
+ if (t.show) {
185
+ var pos = Math.round(axis.u2p(t.value)) + 0.5;
186
+ switch (name) {
187
+ case 'xaxis':
188
+ // draw the grid line if we should
189
+ if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
190
+ drawLine(pos, this._top, pos, this._bottom);
191
+ }
192
+
193
+ // draw the mark
194
+ if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
195
+ s = t.markSize;
196
+ m = t.mark;
197
+ var pos = Math.round(axis.u2p(t.value)) + 0.5;
198
+ switch (m) {
199
+ case 'outside':
200
+ b = this._bottom;
201
+ e = this._bottom+s;
202
+ break;
203
+ case 'inside':
204
+ b = this._bottom-s;
205
+ e = this._bottom;
206
+ break;
207
+ case 'cross':
208
+ b = this._bottom-s;
209
+ e = this._bottom+s;
210
+ break;
211
+ default:
212
+ b = this._bottom;
213
+ e = this._bottom+s;
214
+ break;
215
+ }
216
+ // draw the shadow
217
+ if (this.shadow) {
218
+ this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
219
+ }
220
+ // draw the line
221
+ drawLine(pos, b, pos, e);
222
+ }
223
+ break;
224
+ case 'yaxis':
225
+ // draw the grid line
226
+ if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
227
+ drawLine(this._right, pos, this._left, pos);
228
+ }
229
+
230
+ // draw the mark
231
+ if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
232
+ s = t.markSize;
233
+ m = t.mark;
234
+ var pos = Math.round(axis.u2p(t.value)) + 0.5;
235
+ switch (m) {
236
+ case 'outside':
237
+ b = this._left-s;
238
+ e = this._left;
239
+ break;
240
+ case 'inside':
241
+ b = this._left;
242
+ e = this._left+s;
243
+ break;
244
+ case 'cross':
245
+ b = this._left-s;
246
+ e = this._left+s;
247
+ break;
248
+ default:
249
+ b = this._left-s;
250
+ e = this._left;
251
+ break;
252
+ }
253
+ // draw the shadow
254
+ if (this.shadow) {
255
+ this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
256
+ }
257
+ drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
258
+ }
259
+ break;
260
+ case 'yMidAxis':
261
+ // draw the grid line
262
+ if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
263
+ drawLine(this._left, pos, xp0, pos);
264
+ drawLine(xpn, pos, this._right, pos);
265
+ }
266
+ // draw the mark
267
+ if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
268
+ s = t.markSize;
269
+ m = t.mark;
270
+ var pos = Math.round(axis.u2p(t.value)) + 0.5;
271
+
272
+ b = xp0;
273
+ e = xp0 + s;
274
+ // draw the shadow
275
+ if (this.shadow) {
276
+ this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
277
+ }
278
+ drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
279
+
280
+ b = xpn - s;
281
+ e = xpn;
282
+ // draw the shadow
283
+ if (this.shadow) {
284
+ this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
285
+ }
286
+ drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
287
+ }
288
+ break;
289
+ case 'x2axis':
290
+ // draw the grid line
291
+ if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
292
+ drawLine(pos, this._bottom, pos, this._top);
293
+ }
294
+
295
+ // draw the mark
296
+ if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
297
+ s = t.markSize;
298
+ m = t.mark;
299
+ var pos = Math.round(axis.u2p(t.value)) + 0.5;
300
+ switch (m) {
301
+ case 'outside':
302
+ b = this._top-s;
303
+ e = this._top;
304
+ break;
305
+ case 'inside':
306
+ b = this._top;
307
+ e = this._top+s;
308
+ break;
309
+ case 'cross':
310
+ b = this._top-s;
311
+ e = this._top+s;
312
+ break;
313
+ default:
314
+ b = this._top-s;
315
+ e = this._top;
316
+ break;
317
+ }
318
+ // draw the shadow
319
+ if (this.shadow) {
320
+ this.renderer.shadowRenderer.draw(ctx, [[pos,b],[pos,e]], {lineCap:'butt', lineWidth:this.gridLineWidth, offset:this.gridLineWidth*0.75, depth:2, fill:false, closePath:false});
321
+ }
322
+ drawLine(pos, b, pos, e);
323
+ }
324
+ break;
325
+ case 'y2axis':
326
+ // draw the grid line
327
+ if (t.showGridline && this.drawGridlines && (!t.isMinorTick || axis.showMinorTicks)) {
328
+ drawLine(this._left, pos, this._right, pos);
329
+ }
330
+
331
+ // draw the mark
332
+ if (t.showMark && t.mark && (!t.isMinorTick || axis.showMinorTicks)) {
333
+ s = t.markSize;
334
+ m = t.mark;
335
+ var pos = Math.round(axis.u2p(t.value)) + 0.5;
336
+ switch (m) {
337
+ case 'outside':
338
+ b = this._right;
339
+ e = this._right+s;
340
+ break;
341
+ case 'inside':
342
+ b = this._right-s;
343
+ e = this._right;
344
+ break;
345
+ case 'cross':
346
+ b = this._right-s;
347
+ e = this._right+s;
348
+ break;
349
+ default:
350
+ b = this._right;
351
+ e = this._right+s;
352
+ break;
353
+ }
354
+ // draw the shadow
355
+ if (this.shadow) {
356
+ this.renderer.shadowRenderer.draw(ctx, [[b, pos], [e, pos]], {lineCap:'butt', lineWidth:this.gridLineWidth*1.5, offset:this.gridLineWidth*0.75, fill:false, closePath:false});
357
+ }
358
+ drawLine(b, pos, e, pos, {strokeStyle:axis.borderColor});
359
+ }
360
+ break;
361
+ default:
362
+ break;
363
+ }
364
+ }
365
+ }
366
+ t = null;
367
+ }
368
+ axis = null;
369
+ ticks = null;
370
+ }
371
+
372
+ ctx.restore();
373
+
374
+ function drawLine(bx, by, ex, ey, opts) {
375
+ ctx.save();
376
+ opts = opts || {};
377
+ if (opts.lineWidth == null || opts.lineWidth != 0){
378
+ $.extend(true, ctx, opts);
379
+ ctx.beginPath();
380
+ ctx.moveTo(bx, by);
381
+ ctx.lineTo(ex, ey);
382
+ ctx.stroke();
383
+ }
384
+ ctx.restore();
385
+ }
386
+
387
+ if (this.shadow) {
388
+ if (axes.yMidAxis.show) {
389
+ var points = [[this._left, this._bottom], [xp0, this._bottom]];
390
+ this.renderer.shadowRenderer.draw(ctx, points);
391
+ var points = [[xpn, this._bottom], [this._right, this._bottom], [this._right, this._top]];
392
+ this.renderer.shadowRenderer.draw(ctx, points);
393
+ var points = [[xp0, this._bottom], [xp0, this._top]];
394
+ this.renderer.shadowRenderer.draw(ctx, points);
395
+ }
396
+ else {
397
+ var points = [[this._left, this._bottom], [this._right, this._bottom], [this._right, this._top]];
398
+ this.renderer.shadowRenderer.draw(ctx, points);
399
+ }
400
+ }
401
+ // Now draw border around grid. Use axis border definitions. start at
402
+ // upper left and go clockwise.
403
+ if (this.borderWidth != 0 && this.drawBorder) {
404
+ if (axes.yMidAxis.show) {
405
+ drawLine (this._left, this._top, xp0, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
406
+ drawLine (xpn, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
407
+ drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
408
+ drawLine (this._right, this._bottom, xpn, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
409
+ drawLine (xp0, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
410
+ drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
411
+ drawLine (xp0, this._bottom, xp0, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
412
+ drawLine (xpn, this._bottom, xpn, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
413
+ }
414
+ else {
415
+ drawLine (this._left, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
416
+ drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
417
+ drawLine (this._right, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
418
+ drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
419
+ }
420
+ }
421
+ // ctx.lineWidth = this.borderWidth;
422
+ // ctx.strokeStyle = this.borderColor;
423
+ // ctx.strokeRect(this._left, this._top, this._width, this._height);
424
+
425
+ ctx.restore();
426
+ ctx = null;
427
+ axes = null;
428
+ };
429
+ })(jQuery);
@@ -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(a){a.jqplot.PyramidGridRenderer=function(){a.jqplot.CanvasGridRenderer.call(this)};a.jqplot.PyramidGridRenderer.prototype=new a.jqplot.CanvasGridRenderer();a.jqplot.PyramidGridRenderer.prototype.constructor=a.jqplot.PyramidGridRenderer;a.jqplot.CanvasGridRenderer.prototype.init=function(c){this._ctx;this.plotBands={show:false,color:"rgb(230, 219, 179)",axis:"y",start:null,interval:10};a.extend(true,this,c);var b={lineJoin:"miter",lineCap:"round",fill:false,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.shadowWidth,closePath:false,strokeStyle:this.shadowColor};this.renderer.shadowRenderer.init(b)};a.jqplot.PyramidGridRenderer.prototype.draw=function(){this._ctx=this._elem.get(0).getContext("2d");var D=this._ctx;var G=this._axes;var q=G.xaxis.u2p;var J=G.yMidAxis.u2p;var l=G.xaxis.max/1000;var u=q(0);var f=q(l);var r=["xaxis","yaxis","x2axis","y2axis","yMidAxis"];D.save();D.clearRect(0,0,this._plotDimensions.width,this._plotDimensions.height);D.fillStyle=this.backgroundColor||this.background;D.fillRect(this._left,this._top,this._width,this._height);if(this.plotBands.show){D.save();var c=this.plotBands;D.fillStyle=c.color;var d;var o,n,p,I;if(c.axis.charAt(0)==="x"){if(G.xaxis.show){d=G.xaxis}}else{if(c.axis.charAt(0)==="y"){if(G.yaxis.show){d=G.yaxis}else{if(G.y2axis.show){d=G.y2axis}else{if(G.yMidAxis.show){d=G.yMidAxis}}}}}if(d!==undefined){var g=c.start;if(g===null){g=d.min}for(var H=g;H<d.max;H+=2*c.interval){if(d.name.charAt(0)==="y"){o=this._left;if((H+c.interval)<d.max){n=d.series_u2p(H+c.interval)+this._top}else{n=d.series_u2p(d.max)+this._top}p=this._right-this._left;I=d.series_u2p(g)-d.series_u2p(g+c.interval);D.fillRect(o,n,p,I)}}}D.restore()}D.save();D.lineJoin="miter";D.lineCap="butt";D.lineWidth=this.gridLineWidth;D.strokeStyle=this.gridLineColor;var L,K,A,C;for(var H=5;H>0;H--){var O=r[H-1];var d=G[O];var M=d._ticks;var B=M.length;if(d.show){if(d.drawBaseline){var N={};if(d.baselineWidth!==null){N.lineWidth=d.baselineWidth}if(d.baselineColor!==null){N.strokeStyle=d.baselineColor}switch(O){case"xaxis":if(G.yMidAxis.show){z(this._left,this._bottom,u,this._bottom,N);z(f,this._bottom,this._right,this._bottom,N)}else{z(this._left,this._bottom,this._right,this._bottom,N)}break;case"yaxis":z(this._left,this._bottom,this._left,this._top,N);break;case"yMidAxis":z(u,this._bottom,u,this._top,N);z(f,this._bottom,f,this._top,N);break;case"x2axis":if(G.yMidAxis.show){z(this._left,this._top,u,this._top,N);z(f,this._top,this._right,this._top,N)}else{z(this._left,this._bottom,this._right,this._bottom,N)}break;case"y2axis":z(this._right,this._bottom,this._right,this._top,N);break}}for(var E=B;E>0;E--){var v=M[E-1];if(v.show){var k=Math.round(d.u2p(v.value))+0.5;switch(O){case"xaxis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(k,this._top,k,this._bottom)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._bottom;K=this._bottom+A;break;case"inside":L=this._bottom-A;K=this._bottom;break;case"cross":L=this._bottom-A;K=this._bottom+A;break;default:L=this._bottom;K=this._bottom+A;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[k,L],[k,K]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}z(k,L,k,K)}break;case"yaxis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(this._right,k,this._left,k)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._left-A;K=this._left;break;case"inside":L=this._left;K=this._left+A;break;case"cross":L=this._left-A;K=this._left+A;break;default:L=this._left-A;K=this._left;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor})}break;case"yMidAxis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(this._left,k,u,k);z(f,k,this._right,k)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;L=u;K=u+A;if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor});L=f-A;K=f;if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor})}break;case"x2axis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(k,this._bottom,k,this._top)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._top-A;K=this._top;break;case"inside":L=this._top;K=this._top+A;break;case"cross":L=this._top-A;K=this._top+A;break;default:L=this._top-A;K=this._top;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[k,L],[k,K]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}z(k,L,k,K)}break;case"y2axis":if(v.showGridline&&this.drawGridlines&&(!v.isMinorTick||d.showMinorTicks)){z(this._left,k,this._right,k)}if(v.showMark&&v.mark&&(!v.isMinorTick||d.showMinorTicks)){A=v.markSize;C=v.mark;var k=Math.round(d.u2p(v.value))+0.5;switch(C){case"outside":L=this._right;K=this._right+A;break;case"inside":L=this._right-A;K=this._right;break;case"cross":L=this._right-A;K=this._right+A;break;default:L=this._right;K=this._right+A;break}if(this.shadow){this.renderer.shadowRenderer.draw(D,[[L,k],[K,k]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}z(L,k,K,k,{strokeStyle:d.borderColor})}break;default:break}}}v=null}d=null;M=null}D.restore();function z(j,i,e,b,h){D.save();h=h||{};if(h.lineWidth==null||h.lineWidth!=0){a.extend(true,D,h);D.beginPath();D.moveTo(j,i);D.lineTo(e,b);D.stroke()}D.restore()}if(this.shadow){if(G.yMidAxis.show){var F=[[this._left,this._bottom],[u,this._bottom]];this.renderer.shadowRenderer.draw(D,F);var F=[[f,this._bottom],[this._right,this._bottom],[this._right,this._top]];this.renderer.shadowRenderer.draw(D,F);var F=[[u,this._bottom],[u,this._top]];this.renderer.shadowRenderer.draw(D,F)}else{var F=[[this._left,this._bottom],[this._right,this._bottom],[this._right,this._top]];this.renderer.shadowRenderer.draw(D,F)}}if(this.borderWidth!=0&&this.drawBorder){if(G.yMidAxis.show){z(this._left,this._top,u,this._top,{lineCap:"round",strokeStyle:G.x2axis.borderColor,lineWidth:G.x2axis.borderWidth});z(f,this._top,this._right,this._top,{lineCap:"round",strokeStyle:G.x2axis.borderColor,lineWidth:G.x2axis.borderWidth});z(this._right,this._top,this._right,this._bottom,{lineCap:"round",strokeStyle:G.y2axis.borderColor,lineWidth:G.y2axis.borderWidth});z(this._right,this._bottom,f,this._bottom,{lineCap:"round",strokeStyle:G.xaxis.borderColor,lineWidth:G.xaxis.borderWidth});z(u,this._bottom,this._left,this._bottom,{lineCap:"round",strokeStyle:G.xaxis.borderColor,lineWidth:G.xaxis.borderWidth});z(this._left,this._bottom,this._left,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth});z(u,this._bottom,u,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth});z(f,this._bottom,f,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth})}else{z(this._left,this._top,this._right,this._top,{lineCap:"round",strokeStyle:G.x2axis.borderColor,lineWidth:G.x2axis.borderWidth});z(this._right,this._top,this._right,this._bottom,{lineCap:"round",strokeStyle:G.y2axis.borderColor,lineWidth:G.y2axis.borderWidth});z(this._right,this._bottom,this._left,this._bottom,{lineCap:"round",strokeStyle:G.xaxis.borderColor,lineWidth:G.xaxis.borderWidth});z(this._left,this._bottom,this._left,this._top,{lineCap:"round",strokeStyle:G.yaxis.borderColor,lineWidth:G.yaxis.borderWidth})}}D.restore();D=null;G=null}})(jQuery);
@@ -0,0 +1,514 @@
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
+ // Need to ensure pyramid axis and grid renderers are loaded.
34
+ // You should load these with script tags in the html head, that is more efficient
35
+ // as the browser will cache the request.
36
+ // Note, have to block with synchronous request in order to execute bar renderer code.
37
+ if ($.jqplot.PyramidAxisRenderer === undefined) {
38
+ $.ajax({
39
+ url: $.jqplot.pluginLocation + 'jqplot.pyramidAxisRenderer.js',
40
+ dataType: "script",
41
+ async: false
42
+ });
43
+ }
44
+
45
+ if ($.jqplot.PyramidGridRenderer === undefined) {
46
+ $.ajax({
47
+ url: $.jqplot.pluginLocation + 'jqplot.pyramidGridRenderer.js',
48
+ dataType: "script",
49
+ async: false
50
+ });
51
+ }
52
+
53
+ $.jqplot.PyramidRenderer = function(){
54
+ $.jqplot.LineRenderer.call(this);
55
+ };
56
+
57
+ $.jqplot.PyramidRenderer.prototype = new $.jqplot.LineRenderer();
58
+ $.jqplot.PyramidRenderer.prototype.constructor = $.jqplot.PyramidRenderer;
59
+
60
+ // called with scope of a series
61
+ $.jqplot.PyramidRenderer.prototype.init = function(options, plot) {
62
+ options = options || {};
63
+ this._type = 'pyramid';
64
+ // Group: Properties
65
+ //
66
+ // prop: barPadding
67
+ this.barPadding = 10;
68
+ this.barWidth = null;
69
+ // prop: fill
70
+ // True to fill the bars.
71
+ this.fill = true;
72
+ // prop: highlightMouseOver
73
+ // True to highlight slice when moused over.
74
+ // This must be false to enable highlightMouseDown to highlight when clicking on a slice.
75
+ this.highlightMouseOver = true;
76
+ // prop: highlightMouseDown
77
+ // True to highlight when a mouse button is pressed over a slice.
78
+ // This will be disabled if highlightMouseOver is true.
79
+ this.highlightMouseDown = false;
80
+ // prop: highlightColors
81
+ // an array of colors to use when highlighting a slice.
82
+ this.highlightColors = [];
83
+ // prop highlightThreshold
84
+ // Expand the highlightable region in the x direction.
85
+ // E.g. a value of 3 will highlight a bar when the mouse is
86
+ // within 3 pixels of the bar in the x direction.
87
+ this.highlightThreshold = 2;
88
+ // prop: synchronizeHighlight
89
+ // Index of another series to highlight when this series is highlighted.
90
+ // null or false to not synchronize.
91
+ this.synchronizeHighlight = false;
92
+ // prop: offsetBars
93
+ // False will center bars on their y value.
94
+ // True will push bars up by 1/2 bar width to fill between their y values.
95
+ // If true, there needs to be 1 more tick than there are bars.
96
+ this.offsetBars = false;
97
+
98
+ // if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
99
+ if (options.highlightMouseDown && options.highlightMouseOver == null) {
100
+ options.highlightMouseOver = false;
101
+ }
102
+
103
+ this.side = 'right';
104
+
105
+ $.extend(true, this, options);
106
+
107
+ // if (this.fill === false) {
108
+ // this.shadow = false;
109
+ // }
110
+
111
+ if (this.side === 'left') {
112
+ this._highlightThreshold = [[-this.highlightThreshold, 0], [-this.highlightThreshold, 0], [0,0], [0,0]];
113
+ }
114
+
115
+ else {
116
+ this._highlightThreshold = [[0,0], [0,0], [this.highlightThreshold, 0], [this.highlightThreshold, 0]];
117
+ }
118
+
119
+ this.renderer.options = options;
120
+ // index of the currenty highlighted point, if any
121
+ this._highlightedPoint = null;
122
+ // Array of actual data colors used for each data point.
123
+ this._dataColors = [];
124
+ this._barPoints = [];
125
+ this.fillAxis = 'y';
126
+ this._primaryAxis = '_yaxis';
127
+ this._xnudge = 0;
128
+
129
+ // set the shape renderer options
130
+ var opts = {lineJoin:'miter', lineCap:'butt', fill:this.fill, fillRect:this.fill, isarc:false, strokeStyle:this.color, fillStyle:this.color, closePath:this.fill, lineWidth: this.lineWidth};
131
+ this.renderer.shapeRenderer.init(opts);
132
+ // set the shadow renderer options
133
+ var shadow_offset = options.shadowOffset;
134
+ // set the shadow renderer options
135
+ if (shadow_offset == null) {
136
+ // scale the shadowOffset to the width of the line.
137
+ if (this.lineWidth > 2.5) {
138
+ shadow_offset = 1.25 * (1 + (Math.atan((this.lineWidth/2.5))/0.785398163 - 1)*0.6);
139
+ // var shadow_offset = this.shadowOffset;
140
+ }
141
+ // for skinny lines, don't make such a big shadow.
142
+ else {
143
+ shadow_offset = 1.25 * Math.atan((this.lineWidth/2.5))/0.785398163;
144
+ }
145
+ }
146
+ var sopts = {lineJoin:'miter', lineCap:'butt', fill:this.fill, fillRect:this.fill, isarc:false, angle:this.shadowAngle, offset:shadow_offset, alpha:this.shadowAlpha, depth:this.shadowDepth, closePath:this.fill, lineWidth: this.lineWidth};
147
+ this.renderer.shadowRenderer.init(sopts);
148
+
149
+ plot.postDrawHooks.addOnce(postPlotDraw);
150
+ plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
151
+
152
+ // if this is the left side of pyramid, set y values to negative.
153
+ if (this.side === 'left') {
154
+ for (var i=0, l=this.data.length; i<l; i++) {
155
+ this.data[i][1] = -Math.abs(this.data[i][1]);
156
+ }
157
+ }
158
+ };
159
+
160
+ // setGridData
161
+ // converts the user data values to grid coordinates and stores them
162
+ // in the gridData array.
163
+ // Called with scope of a series.
164
+ $.jqplot.PyramidRenderer.prototype.setGridData = function(plot) {
165
+ // recalculate the grid data
166
+ var xp = this._xaxis.series_u2p;
167
+ var yp = this._yaxis.series_u2p;
168
+ var data = this._plotData;
169
+ var pdata = this._prevPlotData;
170
+ this.gridData = [];
171
+ this._prevGridData = [];
172
+ var l = data.length;
173
+ var adjust = false;
174
+ var i;
175
+
176
+ // if any data values are < 0, consider this a negative series
177
+ for (i = 0; i < l; i++) {
178
+ if (data[i][1] < 0) {
179
+ this.side = 'left';
180
+ }
181
+ }
182
+
183
+ if (this._yaxis.name === 'yMidAxis' && this.side === 'right') {
184
+ this._xnudge = this._xaxis.max/2000.0;
185
+ adjust = true;
186
+ }
187
+
188
+ for (i = 0; i < l; i++) {
189
+ // if not a line series or if no nulls in data, push the converted point onto the array.
190
+ if (data[i][0] != null && data[i][1] != null) {
191
+ this.gridData.push([xp(data[i][1]), yp(data[i][0])]);
192
+ }
193
+ // else if there is a null, preserve it.
194
+ else if (data[i][0] == null) {
195
+ this.gridData.push([xp(data[i][1]), null]);
196
+ }
197
+ else if (data[i][1] == null) {
198
+ this.gridData.push(null, [yp(data[i][0])]);
199
+ }
200
+ // finally, adjust x grid data if have to
201
+ if (data[i][1] === 0 && adjust) {
202
+ this.gridData[i][0] = xp(this._xnudge);
203
+ }
204
+ }
205
+ };
206
+
207
+ // makeGridData
208
+ // converts any arbitrary data values to grid coordinates and
209
+ // returns them. This method exists so that plugins can use a series'
210
+ // linerenderer to generate grid data points without overwriting the
211
+ // grid data associated with that series.
212
+ // Called with scope of a series.
213
+ $.jqplot.PyramidRenderer.prototype.makeGridData = function(data, plot) {
214
+ // recalculate the grid data
215
+ var xp = this._xaxis.series_u2p;
216
+ var yp = this._yaxis.series_u2p;
217
+ var gd = [];
218
+ var l = data.length;
219
+ var adjust = false;
220
+ var i;
221
+
222
+ // if any data values are < 0, consider this a negative series
223
+ for (i = 0; i < l; i++) {
224
+ if (data[i][1] < 0) {
225
+ this.side = 'left';
226
+ }
227
+ }
228
+
229
+ if (this._yaxis.name === 'yMidAxis' && this.side === 'right') {
230
+ this._xnudge = this._xaxis.max/2000.0;
231
+ adjust = true;
232
+ }
233
+
234
+ for (i = 0; i < l; i++) {
235
+ // if not a line series or if no nulls in data, push the converted point onto the array.
236
+ if (data[i][0] != null && data[i][1] != null) {
237
+ gd.push([xp(data[i][1]), yp(data[i][0])]);
238
+ }
239
+ // else if there is a null, preserve it.
240
+ else if (data[i][0] == null) {
241
+ gd.push([xp(data[i][1]), null]);
242
+ }
243
+ else if (data[i][1] == null) {
244
+ gd.push([null, yp(data[i][0])]);
245
+ }
246
+ // finally, adjust x grid data if have to
247
+ if (data[i][1] === 0 && adjust) {
248
+ gd[i][0] = xp(this._xnudge);
249
+ }
250
+ }
251
+
252
+ return gd;
253
+ };
254
+
255
+ $.jqplot.PyramidRenderer.prototype.setBarWidth = function() {
256
+ // need to know how many data values we have on the approprate axis and figure it out.
257
+ var i;
258
+ var nvals = 0;
259
+ var nseries = 0;
260
+ var paxis = this[this._primaryAxis];
261
+ var s, series, pos;
262
+ nvals = paxis.max - paxis.min;
263
+ var nticks = paxis.numberTicks;
264
+ var nbins = (nticks-1)/2;
265
+ // so, now we have total number of axis values.
266
+ var temp = (this.barPadding === 0) ? 1.0 : 0;
267
+ if (paxis.name == 'xaxis' || paxis.name == 'x2axis') {
268
+ this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals - this.barPadding + temp;
269
+ }
270
+ else {
271
+ if (this.fill) {
272
+ this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals - this.barPadding + temp;
273
+ }
274
+ else {
275
+ this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals;
276
+ }
277
+ }
278
+ };
279
+
280
+ $.jqplot.PyramidRenderer.prototype.draw = function(ctx, gridData, options) {
281
+ var i;
282
+ // Ughhh, have to make a copy of options b/c it may be modified later.
283
+ var opts = $.extend({}, options);
284
+ var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
285
+ var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
286
+ var fill = (opts.fill != undefined) ? opts.fill : this.fill;
287
+ var xp = this._xaxis.series_u2p;
288
+ var yp = this._yaxis.series_u2p;
289
+ var pointx, pointy;
290
+ // clear out data colors.
291
+ this._dataColors = [];
292
+ this._barPoints = [];
293
+
294
+ if (this.renderer.options.barWidth == null) {
295
+ this.renderer.setBarWidth.call(this);
296
+ }
297
+
298
+ // var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
299
+ // var nvals = temp[0];
300
+ // var nseries = temp[1];
301
+ // var pos = temp[2];
302
+ var points = [],
303
+ w,
304
+ h;
305
+
306
+ // this._barNudge = 0;
307
+
308
+ if (showLine) {
309
+ var negativeColors = new $.jqplot.ColorGenerator(this.negativeSeriesColors);
310
+ var positiveColors = new $.jqplot.ColorGenerator(this.seriesColors);
311
+ var negativeColor = negativeColors.get(this.index);
312
+ if (! this.useNegativeColors) {
313
+ negativeColor = opts.fillStyle;
314
+ }
315
+ var positiveColor = opts.fillStyle;
316
+ var base;
317
+ var xstart = this._xaxis.series_u2p(this._xnudge);
318
+ var ystart = this._yaxis.series_u2p(this._yaxis.min);
319
+ var yend = this._yaxis.series_u2p(this._yaxis.max);
320
+ var bw = this.barWidth;
321
+ var bw2 = bw/2.0;
322
+ var points = [];
323
+ var yadj = this.offsetBars ? bw2 : 0;
324
+
325
+ for (var i=0, l=gridData.length; i<l; i++) {
326
+ if (this.data[i][0] == null) {
327
+ continue;
328
+ }
329
+ base = gridData[i][1];
330
+ // not stacked and first series in stack
331
+
332
+ if (this._plotData[i][1] < 0) {
333
+ if (this.varyBarColor && !this._stack) {
334
+ if (this.useNegativeColors) {
335
+ opts.fillStyle = negativeColors.next();
336
+ }
337
+ else {
338
+ opts.fillStyle = positiveColors.next();
339
+ }
340
+ }
341
+ }
342
+ else {
343
+ if (this.varyBarColor && !this._stack) {
344
+ opts.fillStyle = positiveColors.next();
345
+ }
346
+ else {
347
+ opts.fillStyle = positiveColor;
348
+ }
349
+ }
350
+
351
+ if (this.fill) {
352
+
353
+ if (this._plotData[i][1] >= 0) {
354
+ // xstart = this._xaxis.series_u2p(this._xnudge);
355
+ w = gridData[i][0] - xstart;
356
+ h = this.barWidth;
357
+ points = [xstart, base - bw2 - yadj, w, h];
358
+ }
359
+ else {
360
+ // xstart = this._xaxis.series_u2p(0);
361
+ w = xstart - gridData[i][0];
362
+ h = this.barWidth;
363
+ points = [gridData[i][0], base - bw2 - yadj, w, h];
364
+ }
365
+
366
+ this._barPoints.push([[points[0], points[1] + h], [points[0], points[1]], [points[0] + w, points[1]], [points[0] + w, points[1] + h]]);
367
+
368
+ if (shadow) {
369
+ this.renderer.shadowRenderer.draw(ctx, points);
370
+ }
371
+ var clr = opts.fillStyle || this.color;
372
+ this._dataColors.push(clr);
373
+ this.renderer.shapeRenderer.draw(ctx, points, opts);
374
+ }
375
+
376
+ else {
377
+ if (i === 0) {
378
+ points =[[xstart, ystart], [gridData[i][0], ystart], [gridData[i][0], gridData[i][1] - bw2 - yadj]];
379
+ }
380
+
381
+ else if (i < l-1) {
382
+ points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2 - yadj], [gridData[i][0], gridData[i][1] + bw2 - yadj], [gridData[i][0], gridData[i][1] - bw2 - yadj]]);
383
+ }
384
+
385
+ // finally, draw the line
386
+ else {
387
+ points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2 - yadj], [gridData[i][0], gridData[i][1] + bw2 - yadj], [gridData[i][0], yend], [xstart, yend]]);
388
+
389
+ if (shadow) {
390
+ this.renderer.shadowRenderer.draw(ctx, points);
391
+ }
392
+ var clr = opts.fillStyle || this.color;
393
+ this._dataColors.push(clr);
394
+ this.renderer.shapeRenderer.draw(ctx, points, opts);
395
+ }
396
+ }
397
+ }
398
+ }
399
+
400
+ if (this.highlightColors.length == 0) {
401
+ this.highlightColors = $.jqplot.computeHighlightColors(this._dataColors);
402
+ }
403
+
404
+ else if (typeof(this.highlightColors) == 'string') {
405
+ this.highlightColors = [];
406
+ for (var i=0; i<this._dataColors.length; i++) {
407
+ this.highlightColors.push(this.highlightColors);
408
+ }
409
+ }
410
+
411
+ };
412
+
413
+
414
+ // setup default renderers for axes and legend so user doesn't have to
415
+ // called with scope of plot
416
+ function preInit(target, data, options) {
417
+ options = options || {};
418
+ options.axesDefaults = options.axesDefaults || {};
419
+ options.grid = options.grid || {};
420
+ options.legend = options.legend || {};
421
+ options.seriesDefaults = options.seriesDefaults || {};
422
+ // only set these if there is a pie series
423
+ var setopts = false;
424
+ if (options.seriesDefaults.renderer === $.jqplot.PyramidRenderer) {
425
+ setopts = true;
426
+ }
427
+ else if (options.series) {
428
+ for (var i=0; i < options.series.length; i++) {
429
+ if (options.series[i].renderer === $.jqplot.PyramidRenderer) {
430
+ setopts = true;
431
+ }
432
+ }
433
+ }
434
+
435
+ if (setopts) {
436
+ options.axesDefaults.renderer = $.jqplot.PyramidAxisRenderer;
437
+ options.grid.renderer = $.jqplot.PyramidGridRenderer;
438
+ options.seriesDefaults.pointLabels = {show: false};
439
+ }
440
+ }
441
+
442
+ // called within context of plot
443
+ // create a canvas which we can draw on.
444
+ // insert it before the eventCanvas, so eventCanvas will still capture events.
445
+ function postPlotDraw() {
446
+ // Memory Leaks patch
447
+ if (this.plugins.pyramidRenderer && this.plugins.pyramidRenderer.highlightCanvas) {
448
+
449
+ this.plugins.pyramidRenderer.highlightCanvas.resetCanvas();
450
+ this.plugins.pyramidRenderer.highlightCanvas = null;
451
+ }
452
+
453
+ this.plugins.pyramidRenderer = {highlightedSeriesIndex:null};
454
+ this.plugins.pyramidRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
455
+
456
+ this.eventCanvas._elem.before(this.plugins.pyramidRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-pyramidRenderer-highlight-canvas', this._plotDimensions, this));
457
+ this.plugins.pyramidRenderer.highlightCanvas.setContext();
458
+ this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
459
+ }
460
+
461
+ function highlight (plot, sidx, pidx, points) {
462
+ var s = plot.series[sidx];
463
+ var canvas = plot.plugins.pyramidRenderer.highlightCanvas;
464
+ canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
465
+ s._highlightedPoint = pidx;
466
+ plot.plugins.pyramidRenderer.highlightedSeriesIndex = sidx;
467
+ var opts = {fillStyle: s.highlightColors[pidx], fillRect: false};
468
+ s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
469
+ if (s.synchronizeHighlight !== false && plot.series.length >= s.synchronizeHighlight && s.synchronizeHighlight !== sidx) {
470
+ s = plot.series[s.synchronizeHighlight];
471
+ opts = {fillStyle: s.highlightColors[pidx], fillRect: false};
472
+ s.renderer.shapeRenderer.draw(canvas._ctx, s._barPoints[pidx], opts);
473
+ }
474
+ canvas = null;
475
+ }
476
+
477
+ function unhighlight (plot) {
478
+ var canvas = plot.plugins.pyramidRenderer.highlightCanvas;
479
+ canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
480
+ for (var i=0; i<plot.series.length; i++) {
481
+ plot.series[i]._highlightedPoint = null;
482
+ }
483
+ plot.plugins.pyramidRenderer.highlightedSeriesIndex = null;
484
+ plot.target.trigger('jqplotDataUnhighlight');
485
+ canvas = null;
486
+ }
487
+
488
+
489
+ function handleMove(ev, gridpos, datapos, neighbor, plot) {
490
+ if (neighbor) {
491
+ var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
492
+ var evt1 = jQuery.Event('jqplotDataMouseOver');
493
+ evt1.pageX = ev.pageX;
494
+ evt1.pageY = ev.pageY;
495
+ plot.target.trigger(evt1, ins);
496
+ if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.pyramidRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
497
+ var evt = jQuery.Event('jqplotDataHighlight');
498
+ evt.which = ev.which;
499
+ evt.pageX = ev.pageX;
500
+ evt.pageY = ev.pageY;
501
+ plot.target.trigger(evt, ins);
502
+ highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
503
+ }
504
+ }
505
+ else if (neighbor == null) {
506
+ unhighlight (plot);
507
+ }
508
+ }
509
+
510
+ // Have to add hook here, becuase it needs called before series is inited.
511
+ $.jqplot.preInitHooks.push(preInit);
512
+
513
+
514
+ })(jQuery);