Display total call duration in a line chart
by tfischer7103
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<h2>Total Call Duration</h2>
<div id='TotalCallDuration'></div>
JavaScript
$(function() {
// Call Times
$('#TotalCallDuration').highcharts({
chart: {
type: 'line'
},
title: {
text: '',
x: -20 //center
},
xAxis: {
categories: ['Person 1', 'Person 2', 'Person 3', 'Person 4', 'Person 5', 'Person 6', 'Person 7', 'Person 8', 'Person 9', 'Person 10', 'Person 11', ]
},
yAxis: {
title: {
text: 'Total Call Duration'
},
type: 'datetime',
dateTimeLabelFormats: {
minute: '%H:%M:%S'
}
},
tooltip: {
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y: %H:%M:%S}</b><br/>'
},
series: [{
/*data: [1000000, 26500000, 17000050, 79000000, 56000000, 124000000],*/
/*data: [<?php echo rtrim($TotalDurationSeconds, ","); ?>],*/
data: [7464000, 4327000, 3388000, 3611000, 3261000, 5740000, 9433000, 8591000, 8114000, 3059000, 10866000],
dataLabels: {
enabled: false,
formatter: function() {
var time = this.y / 1000;
//var time = this.y;
var hours1 = parseInt(time / 3600);
var mins1 = parseInt((parseInt(time % 3600)) / 60);
return (hours1 < 10 ? '0' + hours1 : hours1) + ':' + (mins1 < 10 ? '0' + mins1 : mins1);
}
},
}]
});
});