From 25393eb1be4534ef88a21d8501a27a258441e8d5 Mon Sep 17 00:00:00 2001 From: Damien Gasparina Date: Tue, 22 Dec 2015 16:45:30 +0100 Subject: [PATCH] Bug fixed + specifitied for graphs --- js/dashboard.js | 16 +++++++++++++++- js/graph.js | 12 ++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/js/dashboard.js b/js/dashboard.js index 8dc72dc..d50d661 100644 --- a/js/dashboard.js +++ b/js/dashboard.js @@ -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; + } + } } } diff --git a/js/graph.js b/js/graph.js index 9acb0cd..e79a255 100644 --- a/js/graph.js +++ b/js/graph.js @@ -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 }; +}