bug fixes
This commit is contained in:
parent
78e7e18631
commit
4f9b76bcea
|
@ -30,6 +30,8 @@
|
||||||
var intervalDashboardTop;
|
var intervalDashboardTop;
|
||||||
var intervalDashboardBottom;
|
var intervalDashboardBottom;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var loadDashboardTop = function () {
|
var loadDashboardTop = function () {
|
||||||
$("#baglist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
$("#baglist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
||||||
$("#buylist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
$("#buylist-refresh-icon").html('<i class="fa fa-circle-o-notch fa-spin fa-fw" data-toggle="tooltip" data-placement="top" title="Loading fresh data..."></i>');
|
||||||
|
@ -68,6 +70,23 @@
|
||||||
if (intervalDashboardBottom != null) {
|
if (intervalDashboardBottom != null) {
|
||||||
clearInterval(intervalDashboardBottom);
|
clearInterval(intervalDashboardBottom);
|
||||||
}
|
}
|
||||||
|
console.log(counterIndex["DashboardBottom"]);
|
||||||
|
|
||||||
|
// Destroy all d3 svg graph to avoid memory leak every 10 refreshes of Dashboard Bottom
|
||||||
|
if (counterIndex["DashboardBottom"] >= 10) {
|
||||||
|
$(".nvtooltip").remove();
|
||||||
|
$("svg > *").remove();
|
||||||
|
$("svg").remove();
|
||||||
|
$("svg").off(); // Remove all event listeners from SVG elements
|
||||||
|
nv.charts = {};
|
||||||
|
nv.graphs = [];
|
||||||
|
nv.logs = {};
|
||||||
|
nv.tooltip = {};
|
||||||
|
window.cleanupData();
|
||||||
|
// Reset the counter
|
||||||
|
counterIndex["DashboardBottom"] = 0;
|
||||||
|
console.log("d3 svg graph destroyed");
|
||||||
|
}
|
||||||
|
|
||||||
// Load dashboard
|
// Load dashboard
|
||||||
$("#dashboardBottom").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/DashboardBottom', '', function (responseText, textStatus, XMLHttpRequest) {
|
$("#dashboardBottom").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/DashboardBottom', '', function (responseText, textStatus, XMLHttpRequest) {
|
||||||
|
@ -84,18 +103,7 @@
|
||||||
// Increment the counter
|
// Increment the counter
|
||||||
counterIndex["DashboardBottom"] = (counterIndex["DashboardBottom"] || 0) + 1;
|
counterIndex["DashboardBottom"] = (counterIndex["DashboardBottom"] || 0) + 1;
|
||||||
|
|
||||||
// Destroy all d3 svg graph to avoid memory leak every 30 refreshes of Dashboard Bottom
|
|
||||||
if (counterIndex["DashboardBottom"] >= 30) {
|
|
||||||
$(".nvtooltip").remove();
|
|
||||||
$("svg > *").remove();
|
|
||||||
$("svg").remove();
|
|
||||||
nv.charts = {};
|
|
||||||
nv.graphs = [];
|
|
||||||
nv.logs = {};
|
|
||||||
nv.tooltip = {};
|
|
||||||
// Reset the counter
|
|
||||||
counterIndex["DashboardBottom"] = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reinstate the interval.
|
// Reinstate the interval.
|
||||||
|
|
|
@ -404,6 +404,9 @@ else
|
||||||
// Get the chart's container
|
// Get the chart's container
|
||||||
var container = d3.select('.trend-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
var container = d3.select('.trend-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
||||||
|
|
||||||
|
// Remove any existing y=0 line
|
||||||
|
container.selectAll('.zero-line').remove();
|
||||||
|
|
||||||
// Get the x-values of the first and last data points
|
// Get the x-values of the first and last data points
|
||||||
var xRange = lineChart.xAxis.scale().range();
|
var xRange = lineChart.xAxis.scale().range();
|
||||||
var xMin = xRange[0];
|
var xMin = xRange[0];
|
||||||
|
@ -412,6 +415,7 @@ else
|
||||||
|
|
||||||
// Add a line at y=0
|
// Add a line at y=0
|
||||||
container.insert('line', ':first-child')
|
container.insert('line', ':first-child')
|
||||||
|
.attr('class', 'zero-line') // Add a class to the line for easy
|
||||||
.attr('x1', xMin) // x position of the first end of the line
|
.attr('x1', xMin) // x position of the first end of the line
|
||||||
.attr('y1', lineChart.yAxis.scale()(0)) // y position of the first end of the line
|
.attr('y1', lineChart.yAxis.scale()(0)) // y position of the first end of the line
|
||||||
.attr('x2', xMax) // x position of the second end of the line
|
.attr('x2', xMax) // x position of the second end of the line
|
||||||
|
|
|
@ -503,6 +503,9 @@
|
||||||
// Get the chart's container
|
// Get the chart's container
|
||||||
var container = d3.select('.profit-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
var container = d3.select('.profit-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
||||||
|
|
||||||
|
// Remove any existing y=0 line
|
||||||
|
container.selectAll('.zero-line').remove();
|
||||||
|
|
||||||
// Check if profitData[0].values is not empty
|
// Check if profitData[0].values is not empty
|
||||||
if (profitData[0].values.length > 0) {
|
if (profitData[0].values.length > 0) {
|
||||||
// Get the x-values of the first and last data points
|
// Get the x-values of the first and last data points
|
||||||
|
@ -511,6 +514,7 @@
|
||||||
|
|
||||||
// Add a line at y=0
|
// Add a line at y=0
|
||||||
container.insert('line', ':first-child')
|
container.insert('line', ':first-child')
|
||||||
|
.attr('class', 'zero-line') // Add a class to the line for easy selection
|
||||||
.attr('x1', xMin) // x position of the first end of the line
|
.attr('x1', xMin) // x position of the first end of the line
|
||||||
.attr('y1', profitChart.yAxis.scale()(0)) // y position of the first end of the line
|
.attr('y1', profitChart.yAxis.scale()(0)) // y position of the first end of the line
|
||||||
.attr('x2', xMax) // x position of the second end of the line
|
.attr('x2', xMax) // x position of the second end of the line
|
||||||
|
|
|
@ -299,13 +299,20 @@
|
||||||
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/js/tablesaw.js"></script>
|
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/js/tablesaw.js"></script>
|
||||||
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/js/tablesaw-init.js"></script>
|
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/js/tablesaw-init.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$(".cdev").circlos();
|
$(".cdev").circlos();
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
$('.text-autocolor').autocolor(false);
|
$('.text-autocolor').autocolor(false);
|
||||||
|
|
||||||
var assetDistributionChart; // Keep a reference to the chart
|
|
||||||
var assetDistributionData; // Keep a reference to the data
|
var assetDistributionData; // Keep a reference to the data
|
||||||
|
|
||||||
@if (!Model.AssetDistributionData.Equals("")) {
|
@if (!Model.AssetDistributionData.Equals("")) {
|
||||||
|
@ -367,27 +374,27 @@
|
||||||
.call(trendChart);
|
.call(trendChart);
|
||||||
|
|
||||||
trendChart.dispatch.on('renderEnd', function() {
|
trendChart.dispatch.on('renderEnd', function() {
|
||||||
// Get the chart's container
|
// Get the chart's container
|
||||||
var container = d3.select('.trend-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
var container = d3.select('.trend-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
||||||
|
|
||||||
// Get the x-values of the first and last data points
|
// Remove any existing y=0 line
|
||||||
var xRange = trendChart.xAxis.scale().range();
|
container.selectAll('.zero-line').remove();
|
||||||
var xMin = xRange[0];
|
|
||||||
var xMax = xRange[1];
|
|
||||||
|
|
||||||
|
// Get the x-values of the first and last data points
|
||||||
|
var xRange = trendChart.xAxis.scale().range();
|
||||||
|
var xMin = xRange[0];
|
||||||
|
var xMax = xRange[1];
|
||||||
|
|
||||||
// Add a line at y=0
|
// Add a line at y=0
|
||||||
container.insert('line', ':first-child')
|
container.insert('line', ':first-child')
|
||||||
.attr('x1', xMin) // x position of the first end of the line
|
.attr('class', 'zero-line') // Add a class to the line for easy selection
|
||||||
.attr('y1', trendChart.yAxis.scale()(0)) // y position of the first end of the line
|
.attr('x1', xMin) // x position of the first end of the line
|
||||||
.attr('x2', xMax) // x position of the second end of the line
|
.attr('y1', trendChart.yAxis.scale()(0)) // y position of the first end of the line
|
||||||
.attr('y2', trendChart.yAxis.scale()(0)) // y position of the second end of the line
|
.attr('x2', xMax) // x position of the second end of the line
|
||||||
.attr('stroke', 'gray') // color of the line
|
.attr('y2', trendChart.yAxis.scale()(0)) // y position of the second end of the line
|
||||||
.attr('stroke-width', 2); // width of the line
|
.attr('stroke', 'gray') // color of the line
|
||||||
|
.attr('stroke-width', 2); // width of the line
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nv.utils.windowResize(trendChart.update);
|
nv.utils.windowResize(trendChart.update);
|
||||||
return trendChart;
|
return trendChart;
|
||||||
});
|
});
|
||||||
|
@ -405,6 +412,7 @@
|
||||||
|
|
||||||
var profitChart; // Keep a reference to the chart
|
var profitChart; // Keep a reference to the chart
|
||||||
var profitData; // Keep a reference to the data
|
var profitData; // Keep a reference to the data
|
||||||
|
|
||||||
|
|
||||||
@if (!Model.ProfitChartDataJSON.Equals("")) {
|
@if (!Model.ProfitChartDataJSON.Equals("")) {
|
||||||
<text>
|
<text>
|
||||||
|
@ -426,6 +434,9 @@
|
||||||
// Get the chart's container
|
// Get the chart's container
|
||||||
var container = d3.select('.profit-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
var container = d3.select('.profit-chart .nv-wrap.nv-lineChart .nv-linesWrap');
|
||||||
|
|
||||||
|
// Remove any existing y=0 line
|
||||||
|
container.selectAll('.zero-line').remove();
|
||||||
|
|
||||||
// Check if profitData[0].values is not empty
|
// Check if profitData[0].values is not empty
|
||||||
if (profitData[0].values.length > 0) {
|
if (profitData[0].values.length > 0) {
|
||||||
// Get the x-values of the first and last data points
|
// Get the x-values of the first and last data points
|
||||||
|
@ -434,12 +445,15 @@
|
||||||
|
|
||||||
// Add a line at y=0
|
// Add a line at y=0
|
||||||
container.insert('line', ':first-child')
|
container.insert('line', ':first-child')
|
||||||
|
.attr('class', 'zero-line') // Add a class to the line for easy selection
|
||||||
.attr('x1', xMin) // x position of the first end of the line
|
.attr('x1', xMin) // x position of the first end of the line
|
||||||
.attr('y1', profitChart.yAxis.scale()(0)) // y position of the first end of the line
|
.attr('y1', profitChart.yAxis.scale()(0)) // y position of the first end of the line
|
||||||
.attr('x2', xMax) // x position of the second end of the line
|
.attr('x2', xMax) // x position of the second end of the line
|
||||||
.attr('y2', profitChart.yAxis.scale()(0)) // y position of the second end of the line
|
.attr('y2', profitChart.yAxis.scale()(0)) // y position of the second end of the line
|
||||||
.attr('stroke', 'gray') // color of the line
|
.attr('stroke', 'gray') // color of the line
|
||||||
.attr('stroke-width', 2); // width of the line
|
.attr('stroke-width', 2); // width of the line
|
||||||
|
|
||||||
|
window.profitChartUpdate = nv.utils.windowResize(function() { profitChart.update(); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -451,12 +465,6 @@
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready(function(){
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function ($) {
|
(function ($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -520,3 +528,16 @@
|
||||||
// Add other charts as needed
|
// Add other charts as needed
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.cleanupData = function() {
|
||||||
|
TCVLiveChart = null;
|
||||||
|
TCVLiveData = null;
|
||||||
|
assetDistributionChart = null;
|
||||||
|
assetDistributionData = null;
|
||||||
|
trendChart = null;
|
||||||
|
trendData = null;
|
||||||
|
profitChart = null;
|
||||||
|
profitData = null;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
|
@ -6,7 +6,7 @@ using Core.Helper;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.7.1")]
|
[assembly: AssemblyVersion("2.7.2")]
|
||||||
[assembly: AssemblyProduct("PT Magic")]
|
[assembly: AssemblyProduct("PT Magic")]
|
||||||
|
|
||||||
namespace PTMagic
|
namespace PTMagic
|
||||||
|
|
Loading…
Reference in New Issue