diff options
Diffstat (limited to 'wqflask/wqflask/static/packages/jqplot/plugins/jqplot.mekkoAxisRenderer.js')
-rwxr-xr-x | wqflask/wqflask/static/packages/jqplot/plugins/jqplot.mekkoAxisRenderer.js | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/wqflask/wqflask/static/packages/jqplot/plugins/jqplot.mekkoAxisRenderer.js b/wqflask/wqflask/static/packages/jqplot/plugins/jqplot.mekkoAxisRenderer.js index 694de41d..74297685 100755 --- a/wqflask/wqflask/static/packages/jqplot/plugins/jqplot.mekkoAxisRenderer.js +++ b/wqflask/wqflask/static/packages/jqplot/plugins/jqplot.mekkoAxisRenderer.js @@ -6,13 +6,13 @@ * Revision: 1121 * * Copyright (c) 2009-2012 Chris Leonello - * jqPlot is currently available for use in all personal or commercial projects - * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL - * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can - * choose the license that best suits your project and use it accordingly. + * jqPlot is currently available for use in all personal or commercial projects + * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL + * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can + * choose the license that best suits your project and use it accordingly. * - * Although not required, the author would appreciate an email letting him - * know of any substantial use of jqPlot. You can reach the author at: + * Although not required, the author would appreciate an email letting him + * know of any substantial use of jqPlot. You can reach the author at: * chris at jqplot dot com or see http://www.jqplot.com/info.php . * * If you are feeling kind and generous, consider supporting the project by @@ -26,7 +26,7 @@ * http://hexmen.com/js/sprintf.js * The author (Ash Searle) has placed this code in the public domain: * "This code is unrestricted: you are free to use it however you like." - * + * */ (function($) { // class: $.jqplot.MekkoAxisRenderer @@ -36,12 +36,12 @@ // for each series scaled to the sum of all the y values. $.jqplot.MekkoAxisRenderer = function() { }; - + // called with scope of axis object. $.jqplot.MekkoAxisRenderer.prototype.init = function(options){ // prop: tickMode // How to space the ticks on the axis. - // 'bar' will place a tick at the width of each bar. + // 'bar' will place a tick at the width of each bar. // This is the default for the x axis. // 'even' will place ticks at even intervals. This is // the default for x2 axis and y axis. y axis cannot be changed. @@ -82,7 +82,7 @@ } } }; - + // called with scope of axis $.jqplot.MekkoAxisRenderer.prototype.draw = function(ctx, plot) { if (this.show) { @@ -95,20 +95,20 @@ // position it and the labels correctly on the plot. var dim=0; var temp; - + var elem = document.createElement('div'); this._elem = $(elem); this._elem.addClass('jqplot-axis jqplot-'+this.name); this._elem.css('position', 'absolute'); elem = null; - + if (this.name == 'xaxis' || this.name == 'x2axis') { this._elem.width(this._plotDimensions.width); } else { this._elem.height(this._plotDimensions.height); } - + // draw the axis label // create a _label object. this.labelOptions.axis = this.name; @@ -116,7 +116,7 @@ if (this._label.show) { this._elem.append(this._label.draw(ctx)); } - + var t, tick, elem; if (this.showTicks) { t = this._ticks; @@ -127,7 +127,7 @@ } } } - + // draw the series labels for (i=0; i<this.barLabels.length; i++) { this.barLabelOptions.axis = this.name; @@ -143,13 +143,13 @@ elem.addClass('jqplot-mekko-barLabel'); elem.appendTo(this._elem); elem = null; - } + } } - + } return this._elem; }; - + // called with scope of an axis $.jqplot.MekkoAxisRenderer.prototype.reset = function() { this.min = this._min; @@ -158,9 +158,9 @@ this.numberTicks = this._numberTicks; // this._ticks = this.__ticks; }; - + // called with scope of axis - $.jqplot.MekkoAxisRenderer.prototype.set = function() { + $.jqplot.MekkoAxisRenderer.prototype.set = function() { var dim = 0; var temp; var w = 0; @@ -182,10 +182,10 @@ } } } - + if (lshow) { w = this._label._elem.outerWidth(true); - h = this._label._elem.outerHeight(true); + h = this._label._elem.outerHeight(true); } if (this.name == 'xaxis') { dim = dim + h; @@ -209,9 +209,9 @@ this._label._elem.css('width', w+'px'); } } - } - }; - + } + }; + // called with scope of axis $.jqplot.MekkoAxisRenderer.prototype.createTicks = function() { // we're are operating on an axis here @@ -224,10 +224,10 @@ var min, max; var pos1, pos2; var t, tt, i, j; - + // if we already have ticks, use them. // ticks must be in order of increasing value. - + if (userTicks.length) { // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed for (i=0; i<userTicks.length; i++){ @@ -246,7 +246,7 @@ t.setTick(ut[0], this.name); this._ticks.push(t); } - + else { t.value = ut; if (!this.showTicks) { @@ -265,7 +265,7 @@ this.max = this._ticks[this.numberTicks-1].value; this.tickInterval = (this.max - this.min) / (this.numberTicks - 1); } - + // we don't have any ticks yet, let's make some! else { if (name == 'xaxis' || name == 'x2axis') { @@ -274,15 +274,15 @@ else { dim = this._plotDimensions.height; } - + // if min, max and number of ticks specified, user can't specify interval. if (this.min != null && this.max != null && this.numberTicks != null) { this.tickInterval = null; } - + min = (this.min != null) ? this.min : db.min; max = (this.max != null) ? this.max : db.max; - + // if min and max are same, space them out a bit.+ if (min == max) { var adj = 0.05; @@ -297,11 +297,11 @@ var rmin, rmax; var temp, prev, curr; var ynumticks = [3,5,6,11,21]; - + // yaxis divide ticks in nice intervals from 0 to 1. - if (this.name == 'yaxis' || this.name == 'y2axis') { + if (this.name == 'yaxis' || this.name == 'y2axis') { this.min = 0; - this.max = 100; + this.max = 100; // user didn't specify number of ticks. if (!this.numberTicks){ if (this.tickInterval) { @@ -337,7 +337,7 @@ this.tickInterval = range / (this.numberTicks - 1); } } - + // user did specify number of ticks. else { this.tickInterval = range / (this.numberTicks - 1); @@ -358,7 +358,7 @@ this._ticks.push(t); } } - + // for x axes, have number ot ticks equal to number of series and ticks placed // at sum of y values for each series. else if (this.tickMode == 'bar') { @@ -374,7 +374,7 @@ } t.setTick(0, this.name); this._ticks.push(t); - + temp = 0; for (i=1; i<this.numberTicks; i++){ @@ -391,7 +391,7 @@ this._ticks.push(t); } this.max = this.max || temp; - + // if user specified a max and it is greater than sum, add a tick if (this.max > temp) { t = new this.tickRenderer(this.tickOptions); @@ -404,10 +404,10 @@ } t.setTick(this.max, this.name); this._ticks.push(t); - + } } - + else if (this.tickMode == 'even') { this.min = 0; this.max = this.max || db.max; @@ -431,11 +431,11 @@ t.setTick(tt, this.name); this._ticks.push(t); } - + } } }; - + // called with scope of axis $.jqplot.MekkoAxisRenderer.prototype.pack = function(pos, offsets) { var ticks = this._ticks; @@ -444,25 +444,25 @@ var offmax = offsets.max; var offmin = offsets.min; var lshow = (this._label == null) ? false : this._label.show; - + for (var p in pos) { this._elem.css(p, pos[p]); } - + this._offsets = offsets; // pixellength will be + for x axes and - for y axes becasue pixels always measured from top left. var pixellength = offmax - offmin; var unitlength = max - min; - + // point to unit and unit to point conversions references to Plot DOM element top left corner. this.p2u = function(p){ return (p - offmin) * unitlength / pixellength + min; }; - + this.u2p = function(u){ return (u - min) * pixellength / unitlength + offmin; }; - + if (this.name == 'xaxis' || this.name == 'x2axis'){ this.series_u2p = function(u){ return (u - min) * pixellength / unitlength; @@ -471,7 +471,7 @@ return p * unitlength / pixellength + min; }; } - + else { this.series_u2p = function(u){ return (u - max) * pixellength / unitlength; @@ -480,14 +480,14 @@ return p * unitlength / pixellength + max; }; } - + if (this.show) { if (this.name == 'xaxis' || this.name == 'x2axis') { for (var i=0; i<ticks.length; i++) { var t = ticks[i]; if (t.show && t.showLabel) { var shim; - + if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) { // will need to adjust auto positioning based on which axis this is. var temp = (this.name == 'xaxis') ? 1 : -1; @@ -553,7 +553,7 @@ else { for (var i=0; i<ticks.length; i++) { var t = ticks[i]; - if (t.show && t.showLabel) { + if (t.show && t.showLabel) { var shim; if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) { // will need to adjust auto positioning based on which axis this is. @@ -588,7 +588,7 @@ else { shim = -t.getHeight()/2; } - + var val = this.u2p(t.value) + shim + 'px'; t._elem.css('top', val); t.pack(); @@ -602,7 +602,7 @@ } else { this._label._elem.css('right', '0px'); - } + } this._label.pack(); } } |