Created
June 27, 2019 18:23
-
-
Save chaoticsmol/79443693b4ee5165a74236593cee2509 to your computer and use it in GitHub Desktop.
Security portfolio chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script> | |
</head> | |
<body> | |
<div style="width: 60%; margin-left: auto; margin-right: auto;"> | |
<canvas id="myChart" width="400" height="400"></canvas> | |
<script> | |
var ctx = document.getElementById('myChart').getContext('2d'); | |
var myChart = new Chart(ctx, { | |
type: 'pie', | |
data: { | |
labels: [ | |
'Operational management', | |
'Routine security practices', | |
'Endpoint security', | |
'Open source software security', | |
'Security awareness / human threats', | |
'Automation', | |
'MozDef', | |
'Cloud Security', | |
'Identity', | |
'Shared (MozDef & ident.)', | |
'Architecture', | |
], | |
datasets: [{ | |
label: '% of Votes', | |
data: [12.5, 12.5, 18.75, 15.6, 12.5, 9.4, 6.2, 6.2, 6.2, 0.0, 0.0], | |
backgroundColor: [ | |
'rgb(255,216,216)', | |
'rgb(255,252,221)', | |
'rgb(255,171,171)', | |
'rgb(221,255,171)', | |
'rgb(171,228,255)', | |
'rgb(217,171,255)', | |
'rgb(248,240,135)', | |
'rgb(184,208,221)', | |
'rgb(208,236,234)', | |
'rgb(0,0,0)', | |
'rgb(0,0,0)', | |
], | |
borderColor: [ | |
], | |
borderWidth: 0 | |
}] | |
}, | |
options: { | |
scales: { | |
yAxes: [{ | |
ticks: { | |
beginAtZero: true | |
} | |
}] | |
} | |
} | |
}); | |
</script> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
current = [ | |
25, | |
20.8, | |
16.7, | |
12.5, | |
8.3, | |
8.3, | |
8.3, | |
0, | |
0 | |
] | |
operational_management = 12.5 | |
routine_security_practices = 12.5 | |
adjusted = [ | |
operational_management, | |
routine_security_practices | |
] + list(map(lambda n: (n / 100.0) * 0.75 * 100.0, current)) | |
print(adjusted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment