mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Fixed status realtime charts not loading when visit chart is hidden.
Cleaned up ResponseHelper to reduce unecessary processing.
This commit is contained in:
parent
d7994ef6ff
commit
a9a80f7a97
@ -246,51 +246,53 @@ $(document).ready(function () {
|
||||
/* ----------------------------------------
|
||||
Visitor History
|
||||
-----------------------------------------*/
|
||||
visitChart = new Highcharts.chart({
|
||||
chart: {
|
||||
renderTo: 'visitor-chart',
|
||||
type: 'line',
|
||||
marginRight: 10
|
||||
},
|
||||
title: {
|
||||
text: 'Daily Visitors'
|
||||
},
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
dateTimeLabelFormats: { // don't display the dummy year
|
||||
month: '%e. %b',
|
||||
year: '%b'
|
||||
if (showVisitorStats) {
|
||||
visitChart = new Highcharts.chart({
|
||||
chart: {
|
||||
renderTo: 'visitor-chart',
|
||||
type: 'line',
|
||||
marginRight: 10
|
||||
},
|
||||
title: {
|
||||
text: 'Date'
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
title: {
|
||||
text: 'Visitors'
|
||||
text: 'Daily Visitors'
|
||||
},
|
||||
min: 0
|
||||
},
|
||||
tooltip: {
|
||||
shared: true,
|
||||
crosshairs: true,
|
||||
headerFormat: '<span style="font-size: 10px">{point.key:%B %e, %Y}</span><br/>',
|
||||
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>'
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'All Visitors',
|
||||
data: []
|
||||
xAxis: {
|
||||
type: 'datetime',
|
||||
dateTimeLabelFormats: { // don't display the dummy year
|
||||
month: '%e. %b',
|
||||
year: '%b'
|
||||
},
|
||||
title: {
|
||||
text: 'Date'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Unique Visitors',
|
||||
data: []
|
||||
}
|
||||
]
|
||||
});
|
||||
yAxis: {
|
||||
title: {
|
||||
text: 'Visitors'
|
||||
},
|
||||
min: 0
|
||||
},
|
||||
tooltip: {
|
||||
shared: true,
|
||||
crosshairs: true,
|
||||
headerFormat: '<span style="font-size: 10px">{point.key:%B %e, %Y}</span><br/>',
|
||||
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y}</b><br/>'
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'All Visitors',
|
||||
data: []
|
||||
},
|
||||
{
|
||||
name: 'Unique Visitors',
|
||||
data: []
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -14,23 +14,19 @@ namespace Teknik.Utilities
|
||||
{
|
||||
try
|
||||
{
|
||||
if (flush)
|
||||
{
|
||||
// If the client isn't here, just quit early
|
||||
if (!response.IsClientConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
response.Flush();
|
||||
}
|
||||
|
||||
int curByte = 0;
|
||||
int processedBytes = 0;
|
||||
byte[] buffer = new byte[chunkSize];
|
||||
int bytesRemaining = length;
|
||||
int bytesToRead = chunkSize;
|
||||
do
|
||||
{
|
||||
// Flush the response
|
||||
if (flush)
|
||||
{
|
||||
//response.OutputStream.Write(buffer, 0, 1);
|
||||
response.Flush();
|
||||
}
|
||||
|
||||
if (chunkSize > bytesRemaining)
|
||||
{
|
||||
bytesToRead = bytesRemaining;
|
||||
@ -39,30 +35,11 @@ namespace Teknik.Utilities
|
||||
processedBytes = stream.Read(buffer, 0, bytesToRead);
|
||||
if (processedBytes > 0)
|
||||
{
|
||||
// If the client isn't here, just quit early
|
||||
if (!response.IsClientConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
response.OutputStream.Write(buffer, 0, processedBytes);
|
||||
|
||||
// Clear the buffer
|
||||
Array.Clear(buffer, 0, chunkSize);
|
||||
|
||||
// Flush the response
|
||||
if (flush)
|
||||
{
|
||||
// If the client isn't here, just quit early
|
||||
if (!response.IsClientConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//response.OutputStream.Write(buffer, 0, 1);
|
||||
response.Flush();
|
||||
}
|
||||
}
|
||||
curByte += processedBytes;
|
||||
bytesRemaining -= processedBytes;
|
||||
}
|
||||
while (processedBytes > 0 && bytesRemaining > 0);
|
||||
|
Loading…
Reference in New Issue
Block a user