Skip to content

Instantly share code, notes, and snippets.

@ewahner
Created February 16, 2015 19:53
Show Gist options
  • Save ewahner/62bf36c4db4163786f04 to your computer and use it in GitHub Desktop.
Save ewahner/62bf36c4db4163786f04 to your computer and use it in GitHub Desktop.
$scope.summary = function() {
services.aggList({
action: 'ConnectionAggs',
}, function(response, headers) {
$scope.serverData = response.servers;
var data = response.items;
$scope.numberOfItems = headers("X-Result-Count");
$scope.noOfPages = Math.ceil($scope.numberOfItems / $scope.pageSize);
if (response.error != null) {
$notification.error("System Error", response.error);
}
var seriesData = [];
$scope.summaryData = [];
$.each(data.serverConnections, function(i, item) {
var amounts = [];
if ($scope.filterServer != "*" && item.serverName != $scope.filterServer) {
return true;
}
$.each(item.connections, function(x, conn) {
amounts.push(conn.connectionCount);
if ($scope.filterServer == "*") {
if (x == item.connections.length - 1) {
$scope.summaryData.push({ serverName: item.serverName, connCount: conn.connectionCount, connectionDate: conn.connectionTime, id: conn.id });
}
} else {
$scope.summaryData.push({ serverName: item.serverName, connCount: conn.connectionCount, connectionDate: conn.connectionTime, id: conn.id });
}
});
seriesData.push({
type: "line",
name: item.serverName,
data: amounts
});
$scope.chartData = {
options: {
chart: {
type: "line"
},
plotOptions: {
series: {
stacking: ""
},
area: {
marker: {
enabled: false,
symbol: "circle",
radius: { hover: { enabled: true } }
}
}
}
},
size: {
width: 1400,
height: 800
},
xAxis: {
categories: data.times,
labels: { rotation: 90, align: "left" }
},
title: { text: "Connection History For Last 30 minutes" },
series: seriesData
};
});
console.log($scope.graphData);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment