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

View File

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