CC-4661: Listener Statistics
- changes for different mount names
This commit is contained in:
parent
8b70136dd6
commit
74fe958cad
4 changed files with 62 additions and 21 deletions
|
@ -7,24 +7,43 @@ $(document).ready(function() {
|
|||
|
||||
getDataAndPlot();
|
||||
|
||||
listenerstat_content.find("#his_submit").click(function(ev){
|
||||
listenerstat_content.find("#his_submit").click(function(){
|
||||
startTimestamp = AIRTIME.utilities.fnGetTimestamp(dateStartId, timeStartId);
|
||||
endTimestamp = AIRTIME.utilities.fnGetTimestamp(dateEndId, timeEndId);
|
||||
getDataAndPlot(startTimestamp, endTimestamp);
|
||||
});
|
||||
|
||||
listenerstat_content.find("#all_mps").change(function(){
|
||||
var mpName = $(this).val();
|
||||
startTimestamp = AIRTIME.utilities.fnGetTimestamp(dateStartId, timeStartId);
|
||||
endTimestamp = AIRTIME.utilities.fnGetTimestamp(dateEndId, timeEndId);
|
||||
getDataAndPlot(startTimestamp, endTimestamp);
|
||||
getDataAndPlot(startTimestamp, endTimestamp, mpName);
|
||||
})
|
||||
});
|
||||
|
||||
function getDataAndPlot(startTimestamp, endTimestamp){
|
||||
function getDataAndPlot(startTimestamp, endTimestamp, mountName){
|
||||
// get data
|
||||
$.get('/Listenerstat/get-data', {startTimestamp: startTimestamp, endTimestamp: endTimestamp}, function(data){
|
||||
data = JSON.parse(data);
|
||||
out = new Array();
|
||||
$.each(data, function(index, v){
|
||||
temp = new Array();
|
||||
temp[0] = new Date(v.timestamp.replace(/-/g,"/"));
|
||||
temp[1] = v.listener_count;
|
||||
out.push(temp);
|
||||
$.each(data, function(mpName, v){
|
||||
plotData = new Array();
|
||||
if (mountName != null && mpName != mountName){
|
||||
console.log(mountName);
|
||||
return true;
|
||||
}
|
||||
$.each(v, function(i, ele){
|
||||
temp = new Array();
|
||||
temp[0] = new Date(ele.timestamp.replace(/-/g,"/"));
|
||||
temp[1] = ele.listener_count;
|
||||
plotData.push(temp);
|
||||
})
|
||||
out.push(plotData);
|
||||
});
|
||||
if (out.length == 0) {
|
||||
out.push(new Array());
|
||||
}
|
||||
plot(out);
|
||||
})
|
||||
}
|
||||
|
@ -32,7 +51,7 @@ function getDataAndPlot(startTimestamp, endTimestamp){
|
|||
function plot(d){
|
||||
oBaseDatePickerSettings = {
|
||||
dateFormat: 'yy-mm-dd',
|
||||
onSelect: function(sDate, oDatePicker) {
|
||||
onSelect: function(sDate, oDatePicker) {
|
||||
$(this).datepicker( "setDate", sDate );
|
||||
}
|
||||
};
|
||||
|
@ -49,10 +68,6 @@ function plot(d){
|
|||
listenerstat_content.find(dateEndId).datepicker(oBaseDatePickerSettings);
|
||||
listenerstat_content.find(timeEndId).timepicker(oBaseTimePickerSettings);
|
||||
|
||||
$.plot($("#flot_placeholder"), [d], { xaxis: { mode: "time", timeformat: "%y/%m/%0d %H:%M:%S" } });
|
||||
|
||||
$("#whole").click(function () {
|
||||
$.plot($("#flot_placeholder"), [d], { xaxis: { mode: "time" } });
|
||||
});
|
||||
$.plot($("#flot_placeholder"), d, { xaxis: { mode: "time", timeformat: "%y/%m/%0d %H:%M:%S" } });
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue