Fix for graphs Latency Gaps report

git-svn-id: svn://192.168.202.10@3724 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2023-05-17 00:27:23 +00:00
parent 7aea5daea6
commit 6b8b8de3be
3 changed files with 165 additions and 4 deletions
@@ -5,6 +5,7 @@
#
# CHANGES
# 230430-1952 - First build
# 230516-2024 - Fix for graphs
#
$startMS = microtime();
@@ -254,10 +255,6 @@ $HEADER.="-->\n";
$HEADER.=" </STYLE>\n";
$HEADER.="<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
$HEADER.="<link rel=\"stylesheet\" href=\"calendar.css\">\n";
$HEADER.="<link rel=\"stylesheet\" href=\"horizontalbargraph.css\">\n";
$HEADER.="<link rel=\"stylesheet\" href=\"verticalbargraph.css\">\n";
$HEADER.="<script language=\"JavaScript\" src=\"wz_jsgraphics.js\"></script>\n";
$HEADER.="<script language=\"JavaScript\" src=\"line.js\"></script>\n";
$HEADER.="<script type=\"text/javascript\" src=\"dygraph.js\"></script>\n";
$HEADER.="<script type=\"text/javascript\" src=\"dygraph_vici.js\"></script>\n";
$HEADER.="<link rel=\"stylesheet\" type=\"text/css\" href=\"dygraph.css\" />\n";
@@ -0,0 +1,50 @@
.dygraph-legend {
font-family: Arial, Helvetica, serif;
font-size: 10pt;
font-weight: bold;
}
.dygraph-title {
font-family: Arial, Helvetica, serif;
color: #000;
text-shadow: #999 2px 2px 2px;
}
dygraph-axis-label {
font-family: Arial, Helvetica, serif;
font-size: 10pt;
color: #900;
text-shadow: #999 1px 1px 1px;
}
.dygraph-axis-label-x {
font-family: Arial, Helvetica, serif;
font-size: 10pt;
color: #900;
text-shadow: #999 1px 1px 1px;
}
.dygraph-axis-label-y {
font-family: Arial, Helvetica, serif;
font-size: 10pt;
color: #900;
text-shadow: #999 1px 1px 1px;
}
.dygraph-xlabel {
font-family: Arial, Helvetica, serif;
font-size: 12pt;
font-weight: bold;
text-shadow: #999 1px 1px 1px;
}
.dygraph-ylabel {
font-family: Arial, Helvetica, serif;
font-size: 12pt;
font-weight: bold;
text-shadow: #999 1px 1px 1px;
}
.loading_text {
font-family: Arial, Helvetica, serif;
font-size: 36pt;
font-weight: bold;
color: #009;
text-shadow: #999 5px 5px 5px;
}
+114
View File
@@ -0,0 +1,114 @@
var RawGraphData="";
function DrawGraph(user, LogDate, IPAddress, API_action)
{
document.getElementById('loading_please_wait').style.display='block';
document.getElementById('chart_div').style.display='none';
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
if (xmlhttp)
{
var GraphQuery = "user=" + user + "&log_date=" + LogDate + "&web_ip=" + IPAddress + "&ACTION="+API_action;
// alert(GraphQuery);
xmlhttp.open('POST', 'dygraph_functions.php');
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
xmlhttp.send(GraphQuery);
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
RawGraphData = xmlhttp.responseText;
if (API_action=="all_agent_latency" || API_action=="latency_gaps")
{
var LSL_value=1;
var stacked=1;
}
else
{
var LSL_value=0;
var stacked=0;
}
var graphTitle='Latency';
if (!user.match("---ALL---"))
{
graphTitle+=' for agent '+user;
}
else
{
graphTitle+=' for ALL agents';
}
graphTitle+=' for '+LogDate;
if (!IPAddress.match("---ALL---"))
{
graphTitle+=' on IP address '+IPAddress;
}
//var graph_data=[];
//var maxLatency=0;
//var graph_array=RawGraphData.split("|");
//alert(graph_array.length);
//for (var i=0; i<graph_array.length; i++)
// {
// dataset=graph_array[i].split(",");
// if (i<5) {alert(dataset[0]);}
// graph_data.push([dataset[0], parseInt(dataset[1])]);
// if (parseInt(dataset[1])>maxLatency)
// {
// maxLatency=parseInt(dataset[1]);
// }
// }
if (!LatencyGraph)
{
// alert(RawGraphData);
var LatencyGraph=new Dygraph(document.getElementById("latency_graph_div"), RawGraphData,
{
title: graphTitle,
labelsDiv: document.getElementById("legend_div"),
drawPoints: true,
showRoller: false,
resizable: "both",
// legend: 'follow',
// legendFollowOffsetX: 5,
// legendFollowOffsetY: -5,
labelsSeparateLines: LSL_value,
connectSeparatedPoints: false,
drawGapEdgePoints: false,
ylabel: 'Latency',
xlabel: 'Time (HH:mm:ss)',
strokeWidth: 1.5
} );
}
else
{
LatencyGraph.updateOptions( {'file': RawGraphData, title: graphTitle} );
}
document.getElementById('loading_please_wait').style.display='none';
document.getElementById('chart_div').style.display='block';
}
}
}
}