|
@@ -17,7 +17,25 @@
|
|
|
<small>Leave end range as empty for showing starting day only statistic</small>
|
|
|
</div>
|
|
|
<div class="ui divider"></div>
|
|
|
- <div class="ui basic segment">
|
|
|
+ <div id="statisticRenderNotEnoughData" class="ui segment" style="padding: 2em;" align="center">
|
|
|
+ <h4 class="ui icon header" style="color: #7c7c7c !important;">
|
|
|
+ <i class="medium icons">
|
|
|
+ <i class="chart pie icon"></i>
|
|
|
+ <i class="small corner remove icon" style="
|
|
|
+ font-size: 1.4em;
|
|
|
+ margin-right: -0.2em;
|
|
|
+ margin-bottom: -0em;
|
|
|
+ "></i>
|
|
|
+ </i>
|
|
|
+
|
|
|
+ <div class="content" >
|
|
|
+ Unable To Generate Analytics Report
|
|
|
+ <div class="sub header" style="color: #adadad !important;">The selected period contains too little or no request data collected. <br>
|
|
|
+ Please select a larger range or make sure there are enough traffic routing through this site.</div>
|
|
|
+ </div>
|
|
|
+ </h4>
|
|
|
+ </div>
|
|
|
+ <div id="statisticRenderElement" class="ui basic segment">
|
|
|
<!-- Client Geolocation Analysis-->
|
|
|
<h3>Visitors Countries</h3>
|
|
|
<p>Distributions of visitors by country code. Access origin are estimated using open source GeoIP database and might not be accurate.</p>
|
|
@@ -102,16 +120,23 @@
|
|
|
</div>
|
|
|
<script>
|
|
|
var statisticCharts = [];
|
|
|
- function initStatisticSummery(startdate="", enddate=""){
|
|
|
- if (startdate == "" && enddate == "" ){
|
|
|
- let todaykey = getTodayStatisticKey();
|
|
|
- loadStatisticByDate(todaykey);
|
|
|
- }else if ((startdate != "" && enddate == "") || startdate == enddate){
|
|
|
- //Load the target date
|
|
|
- let targetDate = startdate.trim();
|
|
|
- loadStatisticByDate(targetDate);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ //Start day must be earlier than end date
|
|
|
+ function initStatisticSummery(startdate="", enddate=""){
|
|
|
+ if (startdate == "" && enddate == "" ){
|
|
|
+ let todaykey = getTodayStatisticKey();
|
|
|
+ loadStatisticByDate(todaykey);
|
|
|
+ }else if ((startdate != "" && enddate == "") || startdate == enddate){
|
|
|
+ //Load the target date
|
|
|
+ let targetDate = startdate.trim();
|
|
|
+ loadStatisticByDate(targetDate);
|
|
|
+ }else{
|
|
|
+ //Two dates are given and they are not identical
|
|
|
+
|
|
|
+ console.log(startdate, enddate);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
function loadStatisticByDate(dateid){
|
|
|
$.getJSON("/api/analytic/load?id=" + dateid, function(data){
|
|
@@ -120,6 +145,16 @@
|
|
|
thisChart.destroy();
|
|
|
})
|
|
|
|
|
|
+ if (data.TotalRequest == 0){
|
|
|
+ //No data to analysis
|
|
|
+ $("#statisticRenderElement").hide()
|
|
|
+ $("#statisticRenderNotEnoughData").show();
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ $("#statisticRenderElement").show();
|
|
|
+ $("#statisticRenderNotEnoughData").hide();
|
|
|
+ }
|
|
|
+
|
|
|
//Render visitor data
|
|
|
renderVisitorChart(data.RequestOrigin);
|
|
|
|
|
@@ -148,6 +183,13 @@
|
|
|
function handleLoadStatisticButtonPress(){
|
|
|
var sd = $("#statsRangeStart").val();
|
|
|
var ed = $("#statsRangeEnd").val();
|
|
|
+ //Swap them if sd is later than ed
|
|
|
+ if (sd > ed) {
|
|
|
+ ed = [sd, sd = ed][0];
|
|
|
+ $("#statsRangeStart").val(sd);
|
|
|
+ $("#statsRangeEnd").val(ed);
|
|
|
+ }
|
|
|
+
|
|
|
initStatisticSummery(sd, ed);
|
|
|
}
|
|
|
|