TCV: @totalCurrentValueString @Model.Summary.MainMarket
@@ -96,7 +96,7 @@
Name |
Markets |
Timeframe |
-
Threshold
+ | Threshold
|
Change |
@@ -324,28 +324,13 @@
assetDistributionData = @Html.Raw(Model.AssetDistributionData);
- d3.select("#AssetDistribution svg")
+ d3.select(".asset-distribution svg") // Change this line
.style('height', '90%')
.style('width', '100%')
.datum(assetDistributionData)
.transition().duration(0)
.call(assetDistributionChart);
-
- // Add mouseleave, and mousemove event listeners to hide tooltip
- d3.select('.profit-chart').on('mouseleave', function() {
- d3.select('.nvtooltip').style('opacity', 0);
- });
-
- d3.select('body').on('mousemove', function() {
- var chartBounds = d3.select('.profit-chart')[0][0].getBoundingClientRect();
- var mouseX = d3.event.clientX;
- var mouseY = d3.event.clientY;
-
- if (mouseX < chartBounds.left || mouseX > chartBounds.right || mouseY < chartBounds.top || mouseY > chartBounds.bottom) {
- d3.select('.nvtooltip').style('opacity', 0);
- }
- });
nv.utils.windowResize(assetDistributionChart.update);
return assetDistributionChart;
});
@@ -375,24 +360,34 @@
trendData = @Html.Raw(Model.TrendChartDataJSON);
- d3.select('.trend-chart svg')
+ var svg = d3.select('.trend-chart svg').node();
+ d3.select(svg)
.datum(trendData)
.transition().duration(0)
.call(trendChart);
- // Add mouseleave, and mousemove event listeners to hide tooltip
- d3.select('.profit-chart').on('mouseleave', function() {
- d3.select('.nvtooltip').style('opacity', 0);
+
+ trendChart.dispatch.on('renderEnd', function() {
+ // Get the chart's container
+ var container = d3.select('.trend-chart .nv-wrap.nv-lineChart .nv-linesWrap');
+
+ // 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('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
+ .attr('y2', trendChart.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
});
- d3.select('body').on('mousemove', function() {
- var chartBounds = d3.select('.profit-chart')[0][0].getBoundingClientRect();
- var mouseX = d3.event.clientX;
- var mouseY = d3.event.clientY;
+
- if (mouseX < chartBounds.left || mouseX > chartBounds.right || mouseY < chartBounds.top || mouseY > chartBounds.bottom) {
- d3.select('.nvtooltip').style('opacity', 0);
- }
- });
nv.utils.windowResize(trendChart.update);
return trendChart;
});
@@ -427,20 +422,27 @@
.transition().duration(0)
.call(profitChart);
- // Add mouseleave, and mousemove event listeners to hide tooltip
- d3.select('.profit-chart').on('mouseleave', function() {
- d3.select('.nvtooltip').style('opacity', 0);
- });
+ profitChart.dispatch.on('renderEnd', function() {
+ // Get the chart's container
+ var container = d3.select('.profit-chart .nv-wrap.nv-lineChart .nv-linesWrap');
- d3.select('body').on('mousemove', function() {
- var chartBounds = d3.select('.profit-chart')[0][0].getBoundingClientRect();
- var mouseX = d3.event.clientX;
- var mouseY = d3.event.clientY;
+ // 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
+ var xMin = profitChart.xAxis.scale()(profitData[0].values[0].x);
+ var xMax = profitChart.xAxis.scale()(profitData[0].values[profitData[0].values.length - 1].x);
- if (mouseX < chartBounds.left || mouseX > chartBounds.right || mouseY < chartBounds.top || mouseY > chartBounds.bottom) {
- d3.select('.nvtooltip').style('opacity', 0);
- }
+ // Add a line at y=0
+ container.insert('line', ':first-child')
+ .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
+ }
});
+
nv.utils.windowResize(profitChart.update);
return profitChart;
});
@@ -451,31 +453,10 @@
+
+
+
diff --git a/Monitor/Pages/_get/SettingsMarketTrends.cshtml b/Monitor/Pages/_get/SettingsMarketTrends.cshtml
index a4611bf..f32ef9f 100644
--- a/Monitor/Pages/_get/SettingsMarketTrends.cshtml
+++ b/Monitor/Pages/_get/SettingsMarketTrends.cshtml
@@ -78,7 +78,7 @@