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

« back to all changes in this revision

Viewing changes to html/jqplot/plugins/jqplot.trendline.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(f){f.jqplot.Trendline=function(){this.show=f.jqplot.config.enablePlugins;this.color="#666666";this.renderer=new f.jqplot.LineRenderer();this.rendererOptions={marker:{show:false}};this.label="";this.type="linear";this.shadow=true;this.markerRenderer={show:false};this.lineWidth=1.5;this.shadowAngle=45;this.shadowOffset=1;this.shadowAlpha=0.07;this.shadowDepth=3;this.isTrendline=true};f.jqplot.postSeriesInitHooks.push(e);f.jqplot.postDrawSeriesHooks.push(g);f.jqplot.addLegendRowHooks.push(a);function a(k){var j=null;if(k.trendline&&k.trendline.show){var i=k.trendline.label.toString();if(i){j={label:i,color:k.trendline.color}}}return j}function e(m,k,j,i,l){if(this._type&&(this._type==="line"||this._type=="bar")){this.trendline=new f.jqplot.Trendline();i=i||{};f.extend(true,this.trendline,{color:this.color},j.trendline,i.trendline);this.trendline.renderer.init.call(this.trendline,null)}}function g(m,i){i=f.extend(true,{},this.trendline,i);if(this.trendline&&i.show){var k;var l=i.data||this.data;k=c(l,this.trendline.type);var j=i.gridData||this.renderer.makeGridData.call(this,k.data);this.trendline.renderer.draw.call(this.trendline,m,j,{showLine:true,shadow:this.trendline.shadow})}}function b(w,v,n){var u=(n==null)?"linear":n;var s=w.length;var t;var z;var o=0;var m=0;var r=0;var q=0;var l=0;var j=[];var k=[];if(u=="linear"){k=w;j=v}else{if(u=="exp"||u=="exponential"){for(var p=0;p<v.length;p++){if(v[p]<=0){s--}else{k.push(w[p]);j.push(Math.log(v[p]))}}}}for(var p=0;p<s;p++){o=o+k[p];m=m+j[p];q=q+k[p]*j[p];r=r+k[p]*k[p];l=l+j[p]*j[p]}t=(s*q-o*m)/(s*r-o*o);z=(m-t*o)/s;return[t,z]}function h(k,j){var i;i=b(k,j,"linear");return[i[0],i[1]]}function d(o,m){var k;var i=o;var n=m;k=b(i,n,"exp");var l=Math.exp(k[0]);var j=Math.exp(k[1]);return[l,j]}function c(l,j){var p=(j==null)?"linear":j;var n;var o;var r=[];var q=[];var m=[];for(k=0;k<l.length;k++){if(l[k]!=null&&l[k][0]!=null&&l[k][1]!=null){r.push(l[k][0]);q.push(l[k][1])}}if(p=="linear"){n=h(r,q);for(var k=0;k<r.length;k++){o=n[0]*r[k]+n[1];m.push([r[k],o])}}else{if(p=="exp"||p=="exponential"){n=d(r,q);for(var k=0;k<r.length;k++){o=n[1]*Math.pow(n[0],r[k]);m.push([r[k],o])}}}return{data:m,slope:n[0],intercept:n[1]}}})(jQuery);
 
 
b'\\ No newline at end of file'