seperate date & time on traffic graphs

This commit is contained in:
Charlie Marshall 2013-07-29 23:00:47 +01:00
parent 53bd164217
commit 3bae4ee43d

View File

@ -116,7 +116,8 @@ print('<?xml version="1.0" ?>' . "\n");?>
<text id="ifname" x="<?=$width?>" y="8" <?=$attribs['graphname']?> text-anchor="end"><?=htmlspecialchars($ifname)?></text>
<text id="switch_unit" x="<?=$width*0.55?>" y="5" <?=$attribs['switch_unit']?>><?=gettext("Switch to bytes/s"); ?></text>
<text id="switch_scale" x="<?=$width*0.55?>" y="11" <?=$attribs['switch_scale']?>><?=gettext("AutoScale"); ?> (<?=$scale_type?>)</text>
<text id="datetime" x="<?=$width*0.33?>" y="5" <?=$attribs['legend']?>> </text>
<text id="date" x="<?=$width*0.33?>" y="5" <?=$attribs['legend']?>> </text>
<text id="time" x="<?=$width*0.33?>" y="11" <?=$attribs['legend']?>> </text>
<text id="graphlast" x="<?=$width*0.55?>" y="17" <?=$attribs['legend']?>><?=gettext("Graph shows last"); ?> <?=$time_interval*$nb_plot?> <?=gettext("seconds"); ?></text>
<polygon id="axis_arrow_x" <?=$attribs['axis']?> points="<?=($width) . "," . ($height)?> <?=($width-2) . "," . ($height-2)?> <?=($width-2) . "," . $height?>"/>
<text id="error" x="<?=$width*0.5?>" y="<?=$height*0.5?>" visibility="hidden" <?=$attribs['error']?> text-anchor="middle"><?=$error_text?></text>
@ -209,9 +210,10 @@ function fetch_data() {
function plot_data(obj) {
// Show datetimelegend
var now = new Date();
var datetime = (now.getMonth()+1) + "/" + now.getDate() + "/" + now.getFullYear() + ' ' +
LZ(now.getHours()) + ":" + LZ(now.getMinutes()) + ":" + LZ(now.getSeconds());
SVGDoc.getElementById('datetime').firstChild.data = datetime;
var time = LZ(now.getHours()) + ":" + LZ(now.getMinutes()) + ":" + LZ(now.getSeconds());
SVGDoc.getElementById('time').firstChild.data = time;
var date = (now.getMonth()+1) + "/" + now.getDate() + "/" + now.getFullYear();
SVGDoc.getElementById('date').firstChild.data = date;
if (!obj.success)
return handle_error(); // getURL failed to get data