diff --git a/js/plugins/flot.curvedLines.min.js b/js/plugins/flot.curvedLines.min.js deleted file mode 100644 index e066425a..00000000 --- a/js/plugins/flot.curvedLines.min.js +++ /dev/null @@ -1,41 +0,0 @@ -/* The MIT License - - Copyright (c) 2011 by Michael Zinsmaier and nergal.dev - Copyright (c) 2012 by Thomas Ritou - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - */ -(function($){var options={series:{curvedLines:{active:false,apply:false,fit:false,curvePointFactor:20,fitPointDist:undefined}}};function init(plot){plot.hooks.processOptions.push(processOptions);function processOptions(plot,options){if(options.series.curvedLines.active){plot.hooks.processDatapoints.unshift(processDatapoints);}} -function processDatapoints(plot,series,datapoints){var nrPoints=datapoints.points.length/datapoints.pointsize;var EPSILON=0.5;if(series.curvedLines.apply==true&&series.originSeries===undefined&&nrPoints>(1+EPSILON)){if(series.lines.fill){var pointsTop=calculateCurvePoints(datapoints,series.curvedLines,1),pointsBottom=calculateCurvePoints(datapoints,series.curvedLines,2);datapoints.pointsize=3;datapoints.points=[];var j=0;var k=0;var i=0;var ps=2;while(i0?datapoints.points[k-1]:null;i+=ps;}else{datapoints.points[k]=pointsBottom[j];datapoints.points[k+1]=k>1?datapoints.points[k-2]:null;datapoints.points[k+2]=pointsBottom[j+1];j+=ps;} -k+=3;} -if(series.lines.lineWidth>0){var newSerie=$.extend({},series);newSerie.lines=$.extend({},series.lines);newSerie.lines.fill=undefined;newSerie.label=undefined;newSerie.datapoints=$.extend({},series.datapoints);newSerie.datapoints.points=pointsTop;newSerie.datapoints.pointsize=2;newSerie.curvedLines.apply=false;var allSeries=plot.getData();for(i=0;i0){datapoints.points=calculateCurvePoints(datapoints,series.curvedLines,1);datapoints.pointsize=2;}}} -function calculateCurvePoints(datapoints,curvedLinesOptions,yPos){var points=datapoints.points,ps=datapoints.pointsize;var num=curvedLinesOptions.curvePointFactor*(points.length/ps);var xdata=new Array;var ydata=new Array;var X=0;var Y=yPos;var curX=-1;var curY=-1;var j=0;if(curvedLinesOptions.fit){var fpDist;if(typeof curvedLinesOptions.fitPointDist=='undefined'){var minX=points[0];var maxX=points[points.length-ps];fpDist=(maxX-minX)/(500*100);}else{fpDist=curvedLinesOptions.fitPointDist;} -for(var i=0;i=ps){frontPointY=points[curY-ps];} -if((i+ps)=points[curY]&&backPointY>=points[curY])){xdata[j]=front[X];ydata[j]=front[Y];j++;xdata[j]=points[curX];ydata[j]=points[curY];j++;xdata[j]=back[X];ydata[j]=back[Y];j++;}else{xdata[j]=points[curX];ydata[j]=points[curY];j++;}}}else{for(var i=0;i=0;--j){y2[j]=y2[j]*y2[j+1]+delta[j];} -var step=(xdata[n-1]-xdata[0])/(num-1);var xnew=new Array;var ynew=new Array;var result=new Array;xnew[0]=xdata[0];ynew[0]=ydata[0];result.push(xnew[0]);result.push(ynew[0]);for(j=1;j1){var k=Math.round((max+min)/2);if(xdata[k]>xnew[j]){max=k;}else{min=k;}} -var h=(xdata[max]-xdata[min]);if(h==0){return[];} -var a=(xdata[max]-xnew[j])/h;var b=(xnew[j]-xdata[min])/h;ynew[j]=a*ydata[min]+b*ydata[max]+((a*a*a-a)*y2[min]+(b*b*b-b)*y2[max])*(h*h)/6;result.push(xnew[j]);result.push(ynew[j]);} -return result;}} -$.plot.plugins.push({init:init,options:options,name:'curvedLines',version:'0.5'});})(jQuery); \ No newline at end of file diff --git a/templates/Froxlor/assets/js/traffic.js b/templates/Froxlor/assets/js/traffic.js index b977738a..453dad93 100644 --- a/templates/Froxlor/assets/js/traffic.js +++ b/templates/Froxlor/assets/js/traffic.js @@ -5,6 +5,7 @@ $(document).ready(function() { var ftp = []; var http = []; var mail = []; + var ticks = []; var i = 1; var links = []; $('#datatable tbody tr').reverse().each(function() { @@ -14,6 +15,9 @@ $(document).ready(function() { var maild = $(row).children().first().next().next().next().text(); if ($(row).children().first().find("a").length > 0) { links.push($(row).children().first().html()); + ticks.push([i, $(row).children().first().find("a").html().split(" ")[0]]); + } else { + ticks.push([i, $(row).children().first().html()]); } ftp.push([i, parseFloat(ftpd / 1024)]); http.push([i, parseFloat(httpd / 1024)]); @@ -39,25 +43,31 @@ $(document).ready(function() { var ftpdata = [{ label: 'FTP', data: ftp, - color: '#019522' + color: '#1db34f' }]; var httpdata = [{ label: 'HTTP', data: http, - color: '#0000FF' + color: '#0a90d8' }]; var maildata = [{ label: 'Mail', data: mail, - color: '#800000' + color: '#f17f49' }]; var options = { series: { - shadowSize: 0 + shadowSize: 0, + curvedLines: { + active: true, + apply: false, + fitPointDist: true + } }, lines: { - show: true + show: true, + fill: true }, points: { radius: 2, @@ -72,10 +82,13 @@ $(document).ready(function() { }, xaxis: { tickSize: 1, - tickLength: 0 + tickLength: 0, + ticks: ticks, + labelAngle: 45 }, yaxis: { - tickColor: '#eee' + tickColor: '#eee', + min: 0 } }; diff --git a/templates/Sparkle/assets/js/traffic.js b/templates/Sparkle/assets/js/traffic.js index 5fdf2712..453dad93 100644 --- a/templates/Sparkle/assets/js/traffic.js +++ b/templates/Sparkle/assets/js/traffic.js @@ -5,6 +5,7 @@ $(document).ready(function() { var ftp = []; var http = []; var mail = []; + var ticks = []; var i = 1; var links = []; $('#datatable tbody tr').reverse().each(function() { @@ -14,6 +15,9 @@ $(document).ready(function() { var maild = $(row).children().first().next().next().next().text(); if ($(row).children().first().find("a").length > 0) { links.push($(row).children().first().html()); + ticks.push([i, $(row).children().first().find("a").html().split(" ")[0]]); + } else { + ticks.push([i, $(row).children().first().html()]); } ftp.push([i, parseFloat(ftpd / 1024)]); http.push([i, parseFloat(httpd / 1024)]); @@ -39,17 +43,17 @@ $(document).ready(function() { var ftpdata = [{ label: 'FTP', data: ftp, - color: '#019522' + color: '#1db34f' }]; var httpdata = [{ label: 'HTTP', data: http, - color: '#0000FF' + color: '#0a90d8' }]; var maildata = [{ label: 'Mail', data: mail, - color: '#800000' + color: '#f17f49' }]; var options = { @@ -62,7 +66,8 @@ $(document).ready(function() { } }, lines: { - show: true + show: true, + fill: true }, points: { radius: 2, @@ -77,10 +82,13 @@ $(document).ready(function() { }, xaxis: { tickSize: 1, - tickLength: 0 + tickLength: 0, + ticks: ticks, + labelAngle: 45 }, yaxis: { - tickColor: '#eee' + tickColor: '#eee', + min: 0 } };