@cryptotaxi247 / netdata-1 / commits / 4ae25e477

The axis titles are removed when the charts are too small. Made it by default show 120 seconds of data.

The axis titles are removed when the charts are too small. Made it by default show 120 seconds of data.

box@home root committed Jun 21, 2013 at 00:41 UTC 4ae25e477970cd42ab612dab95cca8108ecdefd4
2 files changed +11 -6
netdata.js
+10 -5
@@ -24,16 +24,21 @@
24 }
25
26 var width = charts_widths[index];
27 - if(width == 0) width = (window.innerWidth - 50) / 2;
28 - if(width <= 10) width = (window.innerWidth - 50) / width;
27 + if(width == 0) width = (window.innerWidth - 40) / 2;
28 + if(width <= 10) width = (window.innerWidth - 40) / width;
29 if(width < 200) width = 200;
30
31 var height = charts_heights[index];
32 - if(height == 0) height = (window.innerHeight - 50) / 2;
33 - if(height <= 10) height = (window.innerHeight - 50) / height;
32 + if(height == 0) height = (window.innerHeight - 20) / 2;
33 + if(height <= 10) height = (window.innerHeight - 20) / height;
34 if(height < 100) height = 100;
35
36 - if(charts[index]) charts[index].draw(charts_data[index], {width: width, height: height, title: charts_titles[index], hAxis: {title: "Time of Day"}, vAxis: {title: "Bandwidth in kbps", minValue: 200}});
36 + var hAxisTitle = null;
37 + var vAxisTitle = null;
38 + if(height >= 150) hAxisTitle = "Time of Day";
39 + if(width >= 400) vAxisTitle = "Bandwidth in kbps";
40 +
41 + if(charts[index]) charts[index].draw(charts_data[index], {width: width, height: height, title: charts_titles[index], hAxis: {title: hAxisTitle}, vAxis: {title: vAxisTitle, minValue: 10}});
42 else console.log('Cannot create chart for ' + charts_urls[index]);
43 }
44
netdata.start
+1 -1
@@ -43,7 +43,7 @@ echo "Compiling netdata"
43 gcc -O3 -o netdata netdata.c || exit 1
44
45 echo "Starting netdata"
46 -./netdata -d -u 1 -l 60 -o "${data}" || exit 1
46 +./netdata -d -u 1 -l 120 -o "${data}" || exit 1
47
48 echo "Waiting 2 seconds for the JSON files"
49 # wait 2 seconds for the JSON files to be generated