-
Notifications
You must be signed in to change notification settings - Fork 0
/
ip_address_vs_risk_score.html
88 lines (81 loc) · 2.57 KB
/
ip_address_vs_risk_score.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!doctype html>
<html>
<head>
<title>Bar Chart</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="../dist/Chart.bundle.js"></script>
<style>
canvas {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
</style>
</head>
<body>
<div id="container" style="width: 65%;">
<canvas id="canvas"></canvas>
</div>
<script>
//Initalize data
var barChartData = {
labels: [],
datasets: [
{
backgroundColor: "rgba(10,10,255,.5)",
data: [],
}
]
};
//Begin reading in data and append to barChartData
$.getJSON('bardata.json')
.done(function(data){
for(var i = 0 ; i < data.length; ++i){
asset_ip_address = data[i].asset_scans_ip_address;
asset_risk_score = data[i].asset_scans_risk_score;
barChartData.labels.push(asset_ip_address);
barChartData.datasets[0].data.push(asset_risk_score);
}
});
//Initialize chart
window.onload = function() {
var ctx = document.getElementById("canvas").getContext("2d");
window.myBar = new Chart(ctx, {
type: 'horizontalBar',
data: barChartData,
options: {
elements: {
rectangle: {
borderWidth: 2,
borderColor: 'rgb(0, 0, 255)',
borderSkipped: 'bottom'
}
},
responsive: true,
legend: {
display: false,
},
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Risk Score'
}
},],
yAxes: [{
scaleLabel: {
display: true,
labelString: 'IP Address'
}
}]
},
title: {
display: true,
text: 'IP Address vs Risk Score'
}
}
});
};
</script>
</body>
</html>