~ubuntu-branches/ubuntu/raring/ntop/raring-proposed

« back to all changes in this revision

Viewing changes to html/jqplot/plugins/jqplot.pointLabels.min.js

  • Committer: Package Import Robot
  • Author(s): Ludovico Cavedon
  • Date: 2012-06-27 00:24:42 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120627002442-9ljq6fhjqzx9qsu6
Tags: 3:4.99.3+ndpi5517+dfsg1-1
* Imported Upstream version 4.99.3 and nDPI r5517.
* get-orig-source.sh: incude nDPI in the orig tarball.
* No longer suggest ntop-graphs and update NEWS about that.
* Update copyright for the new jqPlot library.
* Refresh patches.
* Enable hardening flags.
* Add install-jqplot.patch to install jqPlot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * jqPlot
 
3
 * Pure JavaScript plotting plugin using jQuery
 
4
 *
 
5
 * Version: 1.0.0b2_r1012
 
6
 *
 
7
 * Copyright (c) 2009-2011 Chris Leonello
 
8
 * jqPlot is currently available for use in all personal or commercial projects 
 
9
 * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL 
 
10
 * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can 
 
11
 * choose the license that best suits your project and use it accordingly. 
 
12
 *
 
13
 * Although not required, the author would appreciate an email letting him 
 
14
 * know of any substantial use of jqPlot.  You can reach the author at: 
 
15
 * chris at jqplot dot com or see http://www.jqplot.com/info.php .
 
16
 *
 
17
 * If you are feeling kind and generous, consider supporting the project by
 
18
 * making a donation at: http://www.jqplot.com/donate.php .
 
19
 *
 
20
 * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
 
21
 *
 
22
 *     version 2007.04.27
 
23
 *     author Ash Searle
 
24
 *     http://hexmen.com/blog/2007/03/printf-sprintf/
 
25
 *     http://hexmen.com/js/sprintf.js
 
26
 *     The author (Ash Searle) has placed this code in the public domain:
 
27
 *     "This code is unrestricted: you are free to use it however you like."
 
28
 *
 
29
 * included jsDate library by Chris Leonello:
 
30
 *
 
31
 * Copyright (c) 2010-2011 Chris Leonello
 
32
 *
 
33
 * jsDate is currently available for use in all personal or commercial projects 
 
34
 * under both the MIT and GPL version 2.0 licenses. This means that you can 
 
35
 * choose the license that best suits your project and use it accordingly.
 
36
 *
 
37
 * jsDate borrows many concepts and ideas from the Date Instance 
 
38
 * Methods by Ken Snyder along with some parts of Ken's actual code.
 
39
 * 
 
40
 * Ken's origianl Date Instance Methods and copyright notice:
 
41
 * 
 
42
 * Ken Snyder (ken d snyder at gmail dot com)
 
43
 * 2008-09-10
 
44
 * version 2.0.2 (http://kendsnyder.com/sandbox/date/)     
 
45
 * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
 
46
 *
 
47
 * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
 
48
 * Larry has generously given permission to adapt his code for inclusion
 
49
 * into jqPlot.
 
50
 *
 
51
 * Larry's original code can be found here:
 
52
 *
 
53
 * https://github.com/lsiden/export-jqplot-to-png
 
54
 * 
 
55
 * 
 
56
 */
 
57
(function(c){c.jqplot.PointLabels=function(e){this.show=c.jqplot.config.enablePlugins;this.location="n";this.labelsFromSeries=false;this.seriesLabelIndex=null;this.labels=[];this._labels=[];this.stackedValue=false;this.ypadding=6;this.xpadding=6;this.escapeHTML=true;this.edgeTolerance=-5;this.formatter=c.jqplot.DefaultTickFormatter;this.formatString="";this.hideZeros=false;this._elems=[];c.extend(true,this,e)};var a=["nw","n","ne","e","se","s","sw","w"];var d={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7};var b=["se","s","sw","w","nw","n","ne","e"];c.jqplot.PointLabels.init=function(j,h,f,g,i){var e=c.extend(true,{},f,g);e.pointLabels=e.pointLabels||{};if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"&&!e.pointLabels.location){e.pointLabels.location="e"}this.plugins.pointLabels=new c.jqplot.PointLabels(e.pointLabels);this.plugins.pointLabels.setLabels.call(this)};c.jqplot.PointLabels.prototype.setLabels=function(){var f=this.plugins.pointLabels;var h;if(f.seriesLabelIndex!=null){h=f.seriesLabelIndex}else{if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"){h=0}else{h=(this._plotData.length===0)?0:this._plotData[0].length-1}}f._labels=[];if(f.labels.length===0||f.labelsFromSeries){if(f.stackedValue){if(this._plotData.length&&this._plotData[0].length){for(var e=0;e<this._plotData.length;e++){f._labels.push(this._plotData[e][h])}}}else{var g=this._plotData;if(this.renderer.constructor===c.jqplot.BarRenderer&&this.waterfall){g=this._data}if(g.length&&g[0].length){for(var e=0;e<g.length;e++){f._labels.push(g[e][h])}}g=null}}else{if(f.labels.length){f._labels=f.labels}}};c.jqplot.PointLabels.prototype.xOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerWidth(true)-this.xpadding;break;case"n":h=-f.outerWidth(true)/2;break;case"ne":h=this.xpadding;break;case"e":h=this.xpadding;break;case"se":h=this.xpadding;break;case"s":h=-f.outerWidth(true)/2;break;case"sw":h=-f.outerWidth(true)-this.xpadding;break;case"w":h=-f.outerWidth(true)-this.xpadding;break;default:h=-f.outerWidth(true)-this.xpadding;break}return h};c.jqplot.PointLabels.prototype.yOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerHeight(true)-this.ypadding;break;case"n":h=-f.outerHeight(true)-this.ypadding;break;case"ne":h=-f.outerHeight(true)-this.ypadding;break;case"e":h=-f.outerHeight(true)/2;break;case"se":h=this.ypadding;break;case"s":h=this.ypadding;break;case"sw":h=this.ypadding;break;case"w":h=-f.outerHeight(true)/2;break;default:h=-f.outerHeight(true)-this.ypadding;break}return h};c.jqplot.PointLabels.draw=function(x,j,v){var t=this.plugins.pointLabels;t.setLabels.call(this);for(var w=0;w<t._elems.length;w++){t._elems[w].emptyForce()}t._elems.splice(0,t._elems.length);if(t.show){var r="_"+this._stackAxis+"axis";if(!t.formatString){t.formatString=this[r]._ticks[0].formatString;t.formatter=this[r]._ticks[0].formatter}var D=this._plotData;var A=this._xaxis;var q=this._yaxis;var z,f;for(var w=0,u=t._labels.length;w<u;w++){var o=t._labels[w];if(t.hideZeros&&parseInt(t._labels[w],10)==0){o=""}if(o!=null){o=t.formatter(t.formatString,o)}f=document.createElement("div");t._elems[w]=c(f);z=t._elems[w];z.addClass("jqplot-point-label jqplot-series-"+this.index+" jqplot-point-"+w);z.css("position","absolute");z.insertAfter(x.canvas);if(t.escapeHTML){z.text(o)}else{z.html(o)}var g=t.location;if((this.fillToZero&&D[w][1]<0)||(this.fillToZero&&this._type==="bar"&&this.barDirection==="horizontal"&&D[w][0]<0)||(this.waterfall&&parseInt(o,10))<0){g=b[d[g]]}var n=A.u2p(D[w][0])+t.xOffset(z,g);var h=q.u2p(D[w][1])+t.yOffset(z,g);if(this.renderer.constructor==c.jqplot.BarRenderer){if(this.barDirection=="vertical"){n+=this._barNudge}else{h-=this._barNudge}}z.css("left",n);z.css("top",h);var k=n+z.width();var s=h+z.height();var C=t.edgeTolerance;var e=c(x.canvas).position().left;var y=c(x.canvas).position().top;var B=x.canvas.width+e;var m=x.canvas.height+y;if(n-C<e||h-C<y||k+C>B||s+C>m){z.remove()}z=null;f=null}}};c.jqplot.postSeriesInitHooks.push(c.jqplot.PointLabels.init);c.jqplot.postDrawSeriesHooks.push(c.jqplot.PointLabels.draw)})(jQuery);
 
 
b'\\ No newline at end of file'