mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
allow string values to be graphable in DS stats
This commit is contained in:
parent
a9fc69b4ac
commit
8598360f2e
5 changed files with 29 additions and 7 deletions
|
@ -489,8 +489,13 @@ void AudioMixer::removeHRTFsForFinishedInjector(const QUuid& streamID) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float AudioMixer::percentageForMixStats(int counter) {
|
QString AudioMixer::percentageForMixStats(int counter) {
|
||||||
return (_totalMixes > 0) ? (float(counter) / _totalMixes) * 100.0f : 0;
|
if (_totalMixes > 0) {
|
||||||
|
float mixPercentage = (float(counter) / _totalMixes) * 100.0f;
|
||||||
|
return QString::number(mixPercentage, 'f', 2);
|
||||||
|
} else {
|
||||||
|
return QString("0.0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioMixer::sendStatsPacket() {
|
void AudioMixer::sendStatsPacket() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ private:
|
||||||
|
|
||||||
void perSecondActions();
|
void perSecondActions();
|
||||||
|
|
||||||
float percentageForMixStats(int counter);
|
QString percentageForMixStats(int counter);
|
||||||
|
|
||||||
bool shouldMute(float quietestFrame);
|
bool shouldMute(float quietestFrame);
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,12 @@ tr.new-row {
|
||||||
background-color: #dff0d8;
|
background-color: #dff0d8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.graphable-stat {
|
||||||
|
text-align: center;
|
||||||
|
color: #5286BC;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.highchart-modal .modal-dialog {
|
.highchart-modal .modal-dialog {
|
||||||
width: 650px;
|
width: 650px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
|
<link href="/css/bootstrap.min.css" rel="stylesheet" media="screen">
|
||||||
|
<link href="/stats/css/json.human.css" rel="stylesheet" media="screen">
|
||||||
<link href="/css/style.css" rel="stylesheet" media="screen">
|
<link href="/css/style.css" rel="stylesheet" media="screen">
|
||||||
<link href="/css/sweetalert.css" rel="stylesheet" media="screen">
|
<link href="/css/sweetalert.css" rel="stylesheet" media="screen">
|
||||||
<link href="/css/bootstrap-switch.min.css" rel="stylesheet" media="screen">
|
<link href="/css/bootstrap-switch.min.css" rel="stylesheet" media="screen">
|
||||||
<link href="/stats/css/json.human.css" rel="stylesheet" media="screen">
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
var currentHighchart;
|
var currentHighchart;
|
||||||
|
|
||||||
// setup a function to grab the nodeStats
|
// setup a function to grab the nodeStats
|
||||||
|
@ -17,12 +17,22 @@ $(document).ready(function(){
|
||||||
var stats = JsonHuman.format(json);
|
var stats = JsonHuman.format(json);
|
||||||
|
|
||||||
$('#stats-container').html(stats);
|
$('#stats-container').html(stats);
|
||||||
|
|
||||||
|
// add the clickable class to anything that looks like a number
|
||||||
|
$('.jh-value span').each(function(val){
|
||||||
|
console.log(val);
|
||||||
|
if (!isNaN($(this).text())) {
|
||||||
|
// this looks like a number - give it the clickable class so we can get graphs for it
|
||||||
|
$(this).addClass('graphable-stat');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (currentHighchart) {
|
if (currentHighchart) {
|
||||||
// get the current time to set with the point
|
// get the current time to set with the point
|
||||||
var x = (new Date()).getTime();
|
var x = (new Date()).getTime();
|
||||||
|
|
||||||
// get the last value using underscore-keypath
|
// get the last value using underscore-keypath
|
||||||
var y = _(json).valueForKeyPath(graphKeypath);
|
var y = Number(_(json).valueForKeyPath(graphKeypath));
|
||||||
|
|
||||||
// start shifting the chart once we hit 20 data points
|
// start shifting the chart once we hit 20 data points
|
||||||
var shift = currentHighchart.series[0].data.length > 20;
|
var shift = currentHighchart.series[0].data.length > 20;
|
||||||
|
@ -91,7 +101,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle clicks on numerical values - this lets the user show a line graph in a modal
|
// handle clicks on numerical values - this lets the user show a line graph in a modal
|
||||||
$('#stats-container').on('click', '.jh-type-number', function(){
|
$('#stats-container').on('click', '.graphable-stat', function(){
|
||||||
graphKeypath = $(this).data('keypath');
|
graphKeypath = $(this).data('keypath');
|
||||||
|
|
||||||
// setup the new graph modal
|
// setup the new graph modal
|
||||||
|
|
Loading…
Reference in a new issue