polished graphs for downloads with upload graphs merged in!!!

This commit is contained in:
Hamza 2012-08-01 23:59:12 +08:00
parent 3cdfeb9a50
commit 36dfb82ff4
2 changed files with 12 additions and 7 deletions

View File

@ -37,7 +37,7 @@
margin-bottom: 3px;
}
.active_graph {
height:300px;
height:300px;
margin-top: 10px;
margin-bottom: 10px;
width: 80%;
@ -58,7 +58,7 @@
body {
padding-top: 60px;
}
}
</style>
@ -345,7 +345,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
</a>
<a class="brand" href="#">aria2 Web-Client</a>
<div class="nav-collapse">

View File

@ -1,4 +1,4 @@
var graphSize = 10;
var graphSize = 15;
var graphData = [];
var modals = {
err_connect: undefined,
@ -478,6 +478,7 @@ function deleteDownloadTemplates(top_elem, data) {
if(!found) {
for (var k = 0; k < graphData.length; k++) {
if (graphData[k].gid == gid) {
console.log("removing a graph with gid:" + gid);
graphData.splice(k, 1);
break;
}
@ -509,6 +510,7 @@ function updateGraph(gid) {
if (graphData[i].gid == gid) {
var moreInfo = $(elem).find(".more_info");
if (moreInfo.hasClass("in")) {
window.data = graphData[i];
graphData[i].plot.setData([{
label: "Download Speed",
data: graphData[i].downSpeed,
@ -516,7 +518,7 @@ function updateGraph(gid) {
lines: { show: true }
}, {
label: "Upload Speed",
data: graphData[i].uploadSpeed,
data: graphData[i].upSpeed,
color: "#00ff00",
lines: { show: true }
}]);
@ -551,9 +553,11 @@ function createGraph(gid) {
function updateGraphData(data) {
for (var i = 0; i < data.length; i++) {
var gid = data[i].gid;
var graph;
for (var k = 0; i < graphData.length; i++) {
var graph = null;
console.log(data[i].gid);
for (var k = 0; k < graphData.length; k++) {
if (graphData[k].gid == gid) {
console.log("found a graph with gid:" + gid);
graph = graphData[k];
break;
}
@ -562,6 +566,7 @@ function updateGraphData(data) {
var upSpeed = data[i].uploadSpeed;
var that = this;
if (!graph) {
console.log("creating a new Graph with gid:" + gid);
graphData.push((function() {
return {
gid: gid,