var width = charts_widths[index];
if(width == 0) width = (window.innerWidth - 50) / 2;
- if(width < 10) width = (window.innerWidth - 50) / width;
+ if(width <= 10) width = (window.innerWidth - 50) / width;
+ if(width < 200) width = 200;
- if(charts[index]) charts[index].draw(charts_data[index], {width: width, height: charts_heights[index], title: charts_titles[index], hAxis: {title: "Time of Day"}, vAxis: {title: "Bandwidth in kbps", minValue: 200}});
+ var height = charts_heights[index];
+ if(height == 0) height = (window.innerHeight - 50) / 2;
+ if(height <= 10) height = (window.innerHeight - 50) / height;
+ if(height < 100) height = 100;
+
+ 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}});
else console.log('Cannot create chart for ' + charts_urls[index]);
}
echo >&2 "Directory $base/data already exists. Not touching it, however it should be a link '${data}'."
fi
+echo "Finding proper parameters for dashboard..."
+
+all=`ls "${data}" | grep .json$ | sed "s/\.json$//g"`
+count=0
+for x in $all
+do
+ count=$[count + 1]
+done
+
+w=1
+h=1
+a=1
+while [ $a -lt $count ]
+do
+ if [ $[h+1] -le $w ]
+ then
+ h=$[h+1]
+ else
+ w=$[w+1]
+ h=$[h-1]
+ fi
+ a=$[w*h]
+done
+if [ $w -gt 10 ]
+then
+ w=10
+fi
+if [ $h -gt 10 ]
+then
+ h=10
+fi
+
echo "Generating all.html"
cat >all.html <<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
google.setOnLoadCallback(drawCharts);
function drawCharts() {
- var width = 0; // if zero, auto-adjusts to 50% of screen, 1-10 goes 1/width of screen
- var height = 260;
+ var width = $w; // if zero, auto-adjusts to 50% of screen, 1-10 goes 1/width of screen
+ var height = $h;
// EDIT: add one line per interface you have
// EDIT:
// EDIT: --------------------------------------------------------------------------------
EOF
-all=`ls "${data}" | grep .json$ | sed "s/\.json$//g"`
-count=0
for x in $all
do
- count=$[count + 1]
cat >>all.html <<EOF2
drawChart('${x}', '${x}_div', width, height, "data/${x}.json", "Live Network Usage for ${x}");
EOF2