bug fixes
This commit is contained in:
parent
78e7e18631
commit
4f9b76bcea
|
@ -30,6 +30,8 @@
|
|||
var intervalDashboardTop;
|
||||
var intervalDashboardBottom;
|
||||
|
||||
|
||||
|
||||
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>');
|
||||
$("#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) {
|
||||
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
|
||||
$("#dashboardBottom").load('@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)_get/DashboardBottom', '', function (responseText, textStatus, XMLHttpRequest) {
|
||||
|
@ -84,18 +103,7 @@
|
|||
// Increment the counter
|
||||
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.
|
||||
|
|
|
@ -404,6 +404,9 @@ else
|
|||
// Get the chart's container
|
||||
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
|
||||
var xRange = lineChart.xAxis.scale().range();
|
||||
var xMin = xRange[0];
|
||||
|
@ -412,6 +415,7 @@ else
|
|||
|
||||
// Add a line at y=0
|
||||
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('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
|
||||
|
|
|
@ -503,6 +503,9 @@
|
|||
// Get the chart's container
|
||||
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
|
||||
if (profitData[0].values.length > 0) {
|
||||
// Get the x-values of the first and last data points
|
||||
|
@ -511,6 +514,7 @@
|
|||
|
||||
// Add a line at y=0
|
||||
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('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
|
||||
|
|
|
@ -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-init.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$(".cdev").circlos();
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$('.text-autocolor').autocolor(false);
|
||||
|
||||
var assetDistributionChart; // Keep a reference to the chart
|
||||
var assetDistributionData; // Keep a reference to the data
|
||||
|
||||
@if (!Model.AssetDistributionData.Equals("")) {
|
||||
|
@ -370,14 +377,17 @@
|
|||
// Get the chart's container
|
||||
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
|
||||
var xRange = trendChart.xAxis.scale().range();
|
||||
var xMin = xRange[0];
|
||||
var xMax = xRange[1];
|
||||
|
||||
|
||||
// Add a line at y=0
|
||||
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('y1', trendChart.yAxis.scale()(0)) // y position of the first end of the line
|
||||
.attr('x2', xMax) // x position of the second end of the line
|
||||
|
@ -385,9 +395,6 @@
|
|||
.attr('stroke', 'gray') // color of the line
|
||||
.attr('stroke-width', 2); // width of the line
|
||||
});
|
||||
|
||||
|
||||
|
||||
nv.utils.windowResize(trendChart.update);
|
||||
return trendChart;
|
||||
});
|
||||
|
@ -406,6 +413,7 @@
|
|||
var profitChart; // Keep a reference to the chart
|
||||
var profitData; // Keep a reference to the data
|
||||
|
||||
|
||||
@if (!Model.ProfitChartDataJSON.Equals("")) {
|
||||
<text>
|
||||
nv.addGraph(function () {
|
||||
|
@ -426,6 +434,9 @@
|
|||
// Get the chart's container
|
||||
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
|
||||
if (profitData[0].values.length > 0) {
|
||||
// Get the x-values of the first and last data points
|
||||
|
@ -434,12 +445,15 @@
|
|||
|
||||
// Add a line at y=0
|
||||
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('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('y2', profitChart.yAxis.scale()(0)) // y position of the second end of the line
|
||||
.attr('stroke', 'gray') // color of the line
|
||||
.attr('stroke-width', 2); // width of the line
|
||||
|
||||
window.profitChartUpdate = nv.utils.windowResize(function() { profitChart.update(); });
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -451,12 +465,6 @@
|
|||
})(jQuery);
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
@ -520,3 +528,16 @@
|
|||
// Add other charts as needed
|
||||
});
|
||||
</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;
|
||||
|
||||
|
||||
[assembly: AssemblyVersion("2.7.1")]
|
||||
[assembly: AssemblyVersion("2.7.2")]
|
||||
[assembly: AssemblyProduct("PT Magic")]
|
||||
|
||||
namespace PTMagic
|
||||
|
|
Loading…
Reference in New Issue