fst – Rev 1
?pathlinks?
(function () {
function getPorts(data) {
// Get geographic metrics
const ports = data.ports
var total = 0
Object.keys(ports).forEach(function(item, index) {
++total
})
return Object.keys(ports).map(function (item) {
return {
name: item,
y: ports[item]/total * 100
}
})
}
// Setup incidents map.
$.getJSON('/metrics', function (data) {
data = getPorts(data)
// Initiate the chart
var portsChart = Highcharts.chart('containerServices', {
chart: {
backgroundColor: 'rgba(255, 255, 255, 0.0)',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
events: {
load: function () {
var series = this.series[0]
setInterval(function () {
$.getJSON('/metrics', function (data) {
data = getPorts(data)
// Update series
series.update({
data: data
}, true)
portsChart.redraw()
portsChart.hideLoading()
})
}, 1000)
}
}
},
credits: {
enabled: false
},
title: {
text: ''
},
tooltip: {
pointFormat: '{series.name}: {point.percentage:.1f}%b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
name: 'Occurences',
data: data
}]
})
})
})()
Generated by GNU Enscript 1.6.5.90.