Bug fixed + specifitied for graphs

This commit is contained in:
Damien Gasparina 2015-12-22 16:45:30 +01:00
parent 962882d1c2
commit 25393eb1be
2 changed files with 27 additions and 1 deletions

View File

@ -153,7 +153,11 @@ function processCSV(csv, filename) {
} /* Use sequence for xAxis */
} else {
xValues = Array.apply(null, Array(nlines)).map(function (_, i) {return i;});
graphs.xAxis = function (xa) { xa.axisLabel('').tickFormat(function(d) { return d3.format('d')(new Date(d)); }) };
graphs.xAxis = function (xa) {
xa.axisLabel('').tickFormat(function(d) {
return d3.format('d')(d);
})
};
}
/* Then, populate the graphs object with the CSV values */
@ -183,15 +187,25 @@ function processCSV(csv, filename) {
name = graphs[i].name;
name = name.replace(/[&\/\\#,+()$~%.'":*?<>{}\s]/g,'_');
sfname = name + "_data";
ofname = name + "_options";
gdfunction = undefined;
options = {};
if (typeof window[sfname] == "function") {
gdfunction = window[sfname];
}
if (typeof window[ofname] == "function") {
options = window[ofname]();
}
for (j in graphs[i].d) {
if (gdfunction !== undefined) {
graphs[i].d[j].values = gdfunction(graphs[i].d[j].values);
}
if (options !== undefined) {
if (options.area === true) {
graphs[i].d[j].area = true;
}
}
}
}

View File

@ -12,6 +12,10 @@ function dsk_total_data(data) {
return data;
}
function dsk_total_options() {
return { area: true };
}
function dsk_total_graph(graph) {
graph.yAxis.axisLabel('Trafic (MB)').tickFormat(function(d) { return d3.format('.2f')(d); });
}
@ -55,6 +59,10 @@ function net_total_graph(graph) {
graph.yAxis.axisLabel('Trafic (MB)').tickFormat(function(d) { return d3.format('.2f')(d); });
}
function net_total_options() {
return { area: true };
}
/*
* MongoDB
*/
@ -70,3 +78,7 @@ function mongodb_con_graph(graph) {
function mongodb_mem_graph(graph) {
graph.yAxis.axisLabel('Size (MB)').tickFormat(function(d) { return d3.format('d.0')(d); });
}
function mongodb_mem_options() {
return { area: true };
}