2018-05-22 10:11:50 +02:00
@page
@model DashboardBottomModel
@{
Layout = null;
}
2019-04-30 17:36:27 +02:00
@section Styles {
<link href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/nvd3/nv.d3.min.css" rel="stylesheet" type="text/css" />
<link href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/tablesaw/css/tablesaw.css" rel="stylesheet" type="text/css" />
}
2019-05-01 09:19:37 +02:00
<div class="row">
2024-01-23 19:05:28 +01:00
<div class="col-md-3 px-1">
<div class="card-box px-1" style="height:240px;">
2024-02-02 18:22:39 +01:00
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.DashboardChartsRefreshSeconds * 1000)" data-color="#aaa,#414d59"
title="All charts set to refresh every @Model.PTMagicConfiguration.GeneralSettings.Monitor.DashboardChartsRefreshSeconds seconds in your general settings."></div>
2024-01-23 19:05:28 +01:00
@{
string totalCurrentValueString = Model.totalCurrentValue.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"));
if (Model.totalCurrentValue > 100) {
totalCurrentValueString = Math.Round(Model.totalCurrentValue, 2).ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
}
}
2024-01-30 10:38:19 +01:00
<div class="asset-distribution container" style="height: 100%; width: 100%;">
2024-01-23 19:05:28 +01:00
<div class="text-center">
<span data-toggle="tooltip" data-placement="top" title="Total current account value">TCV: <text class="text-autocolor">@totalCurrentValueString @Model.Summary.MainMarket </text> </span>
</div>
<div class="text-center">
<small>
<span data-toggle="tooltip" data-placement="top" title="Starting balance from PTM settings">Start: <text class="text-autocolor">@Model.MiscData.StartBalance </text></span>
<span data-toggle="tooltip" data-placement="top" title="TCV gain on starting balance">  Gain: <text class="text-autocolor">@Math.Round(((Model.totalCurrentValue - Model.MiscData.StartBalance) / Model.MiscData.StartBalance) * 100, 2)%</text></span>
</small>
</div>
<svg style="height:100%;width:100%"></svg>
</div>
</div>
</div>
<div class="col-md-9">
<div class="card-box px-2" style="height:240px;">
2024-04-10 12:11:43 +02:00
<h4 class="m-t-0 header-title"><b>TCV Trend </b><i class="fa fa-info-circle text-muted" style="font-size x-small" data-toggle="tooltip" data-placement="top" title="Data is added while the monitor is running. Currently set to show the past @Model.PTMagicConfiguration.GeneralSettings.Monitor.LiveTCVTimeframeMinutes minutes in your monitor settings."></i>
2024-01-23 19:05:28 +01:00
@if (!Model.TotalCurrentValueLiveChartDataJSON.Equals("")) {
<div class="TCVLive-chart">
<svg style="height:220px;width:100%"></svg>
</div>
} else {
<p>Unable to load graph, no sales data found.</p>
}
</div>
</div>
</div>
<div class="row">
<div class="col-md-6 px-1">
2024-01-16 17:56:52 +01:00
<div class="card-box px-2" style="height:340px;">
2024-01-21 07:59:24 +01:00
<h4 class="m-t-0 m-b-20 header-title" style="display: inline;"><b>Market Trend History </b><i class="fa fa-info-circle text-muted" style="font-size x-small" data-toggle="tooltip" data-placement="top" title="@Math.Round(Model.DataHours, 1) hours of data available. Currently set to show @Model.PTMagicConfiguration.GeneralSettings.Monitor.GraphMaxTimeframeHours hours at @Model.PTMagicConfiguration.GeneralSettings.Monitor.GraphIntervalMinutes intervals, in general settings."></i></h4>
2019-05-01 09:19:37 +02:00
@if (!Model.TrendChartDataJSON.Equals("")) {
<div class="trend-chart">
2020-03-31 00:34:05 +02:00
<svg style="height: 300px;width: 100%;"></svg>
2019-05-01 09:19:37 +02:00
</div>
} else {
<p>Unable to load graph, no market trend data found.</p>
}
</div>
</div>
2024-01-13 20:10:44 +01:00
2024-01-23 19:05:28 +01:00
2020-07-26 16:28:37 +02:00
2024-01-23 19:05:28 +01:00
<div class="col-md-6 px-1">
2024-01-07 22:53:49 +01:00
@*<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"></div>*@
2024-01-17 18:13:09 +01:00
<div class="card-box px-2" style="height:340px;">
2024-01-23 19:05:28 +01:00
<h4 class="m-t-0 m-b-20 header-title" style="display: inline;">Daily Profit <i class="fa fa-info-circle text-muted" style="font-size x-small" data-toggle="tooltip" data-placement="top" title="@Model.PTData.DailyPNL.Count days of data available. Currently Set to @Model.PTMagicConfiguration.GeneralSettings.Monitor.ProfitsMaxTimeframeDays days in general settings."></i>
2019-05-01 09:19:37 +02:00
@if (!Model.ProfitChartDataJSON.Equals("")) {
<div class="profit-chart">
<svg style="height:300px;width:100%"></svg>
</div>
} else {
<p>Unable to load graph, no sales data found.</p>
}
</div>
</div>
</div>
2024-01-07 22:53:49 +01:00
2018-05-22 10:11:50 +02:00
<div class="row">
2023-12-30 06:46:45 +01:00
<div class="col-md-5 px-1">
2024-01-19 00:11:16 +01:00
<div class="card-box px-3">
@* <div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeco;nds * 1000)" data-color="#aaa,#414d59"></div>
2024-01-13 20:10:44 +01:00
<br> *@
2024-01-23 19:05:28 +01:00
<h4 class="m-t-0 m-b-20 header-title">Live Market Trends
2024-02-02 18:22:39 +01:00
<i class="fa fa-info-circle text-muted" style="font-size small" data-toggle="tooltip" data-placement="top" title="Set to refresh every @Model.PTMagicConfiguration.GeneralSettings.Monitor.DashboardChartsRefreshSeconds seconds in general settings."></i>
2024-01-23 19:05:28 +01:00
<small class="pull-right" style="font-size: small"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)MarketAnalyzer">ANALYZER</a></small>
2024-01-19 00:11:16 +01:00
</h4>
2018-12-19 15:40:44 +01:00
<table class="table table-sm">
<thead>
<tr>
<th>Name</th>
<th class="text-right">Markets</th>
<th class="text-right">Timeframe</th>
2024-01-30 10:38:19 +01:00
<th class="text-right">Threshold <i class="fa fa-info-circle text-muted" data-toggle="tooltip" data-placement="top" title="Pairs exceeding this threshold are considered outliers that are excluded from the trend average."></i>
2024-01-19 00:11:16 +01:00
</th>
2018-12-19 15:40:44 +01:00
<th class="text-right">Change</th>
</tr>
</thead>
<tbody>
@foreach (var marketTrend in Model.MarketTrends.OrderBy(mt => mt.TrendMinutes)) {
2024-01-10 16:58:09 +01:00
if (Model.Summary.MarketTrendChanges.ContainsKey(marketTrend.Name)) {
double trendChange = Model.Summary.MarketTrendChanges[marketTrend.Name].Last().TrendChange;
string trendChangeOutput = trendChange.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US"));
2018-12-19 15:40:44 +01:00
2024-01-10 16:58:09 +01:00
int marketCount = marketTrend.MaxMarkets;
string marketCountString = marketCount.ToString();
2018-12-19 15:40:44 +01:00
2024-01-10 16:58:09 +01:00
if (marketCount == 0) {
marketCountString = "All";
} else if (marketCount > Model.Summary.MarketSummary.Keys.Count && marketTrend.Platform.Equals("Exchange", StringComparison.InvariantCultureIgnoreCase)) {
marketCountString = Model.Summary.MarketSummary.Keys.Count.ToString();
2021-02-01 07:08:33 +01:00
}
2024-01-10 16:58:09 +01:00
// Cache the result of SplitCamelCase(marketTrend.Name)
string splitCamelCaseName = Core.Helper.SystemHelper.SplitCamelCase(marketTrend.Name);
<tr>
<td>@splitCamelCaseName</td> <!-- Use the cached value here -->
<td class="text-right">@marketCountString</td>
<td class="text-right">@Core.Helper.SystemHelper.GetProperDurationTime(marketTrend.TrendMinutes * 60, false)</td>
@if (marketTrend.TrendThreshold == 0)
{
<td class="text-right">--</td>
}
else
{
2024-01-19 00:11:16 +01:00
<td class="text-right">@marketTrend.TrendThreshold %</td>
2024-01-10 16:58:09 +01:00
}
2024-01-19 02:36:36 +01:00
<td class="text-right text-autocolor" style="font-weight:bold;">@trendChangeOutput %</td>
2024-01-10 16:58:09 +01:00
</tr>
}
2018-12-19 15:40:44 +01:00
}
</tbody>
</table>
</div>
</div>
2019-05-01 05:16:37 +02:00
2023-12-30 06:46:45 +01:00
<div class="col-md-7 px-1">
2024-01-19 00:11:16 +01:00
<div class="card-box px-3">
<h4 class="m-t-0 m-b-20 header-title">Sales Overview
2024-01-19 02:36:36 +01:00
<i class="fa fa-info-circle text-muted" style="font-size x-small" data-toggle="tooltip" data-placement="top" title="All data acquired via Profit Trailer API."></i>
2024-01-19 00:11:16 +01:00
<small class="pull-right" style="font-size: small"><a href="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)SalesAnalyzer">ANALYZER</a></small>
</h4>
2020-07-26 16:28:37 +02:00
@{
2024-01-16 17:56:52 +01:00
double avgGrowthThisMonth = Model.PTData.MonthlyStats.FirstOrDefault(data => data.Order == 1)?.AvgGrowth ?? 0.0;
double avgGrowthLastMonth = Model.PTData.MonthlyStats.FirstOrDefault(data => data.Order == 2)?.AvgGrowth ?? 0.0;
2018-05-22 10:11:50 +02:00
2024-01-16 17:56:52 +01:00
//var startingBalance = Model.MiscData.StartBalance;
var totalCurrentValue = Model.totalCurrentValue;
var overviewStats = Model.StatsData;
2023-12-30 06:46:45 +01:00
var todaysSales = overviewStats.SalesToday;
var todaysProfit = overviewStats.ProfitToday;
var todaysFunding = overviewStats.FundingToday;
2024-01-16 17:56:52 +01:00
var todaysPercentGain = overviewStats.ProfitPercToday + Model.PTData.Stats.TotalFundingPercToday;
2023-12-30 06:46:45 +01:00
var yesterdaysSales = overviewStats.SalesYesterday;
var yesterdaysProfit = overviewStats.ProfitYesterday;
var yesterdaysFunding = overviewStats.FundingYesterday;
2024-01-16 17:56:52 +01:00
var yesterdaysPercentGain = overviewStats.ProfitPercYesterday + Model.PTData.Stats.TotalFundingPercYesterday;
2023-12-30 06:46:45 +01:00
var last7DaysSales = overviewStats.SalesWeek;
var last7DaysProfit = overviewStats.ProfitWeek;
var last7DaysFunding = overviewStats.FundingWeek;
2024-01-16 17:56:52 +01:00
var last7DaysPercentGain = overviewStats.ProfitPercWeek + Model.PTData.Stats.TotalFundingPercWeek;
2024-01-07 22:53:49 +01:00
var thisMonthSales = overviewStats.SalesThisMonth;
var thisMonthProfit = overviewStats.ProfitThisMonth;
var thisMonthFunding = overviewStats.FundingThisMonth;
2024-01-16 17:56:52 +01:00
var thisMonthPercentGain = avgGrowthThisMonth;
2023-12-30 06:46:45 +01:00
2024-01-07 22:53:49 +01:00
var lastMonthSales = overviewStats.SalesLastMonth;
var lastMonthProfit = overviewStats.ProfitLastMonth;
var lastMonthFunding = overviewStats.FundingLastMonth;
2024-01-16 17:56:52 +01:00
var lastMonthPercentGain = avgGrowthLastMonth;
2023-12-30 06:46:45 +01:00
var totalSales = overviewStats.TotalSales;
var totalProfit = overviewStats.TotalProfit;
var totalFunding = overviewStats.FundingTotal;
2024-01-16 17:56:52 +01:00
var totalPercentGain = overviewStats.TotalProfitPerc + Model.PTData.Stats.TotalFundingPerc;
2023-12-30 06:46:45 +01:00
2024-01-15 15:12:46 +01:00
double todaysProfitFiat = Math.Round((todaysProfit + todaysFunding) * Model.PTData.Misc.FiatConversionRate, 2);
double yesterdaysProfitFiat = Math.Round((yesterdaysProfit + yesterdaysFunding) * Model.PTData.Misc.FiatConversionRate, 2);
double last7DaysProfitFiat = Math.Round((last7DaysProfit + last7DaysFunding) * Model.PTData.Misc.FiatConversionRate, 2);
double thisMonthProfitFiat = Math.Round((thisMonthProfit + thisMonthFunding) * Model.PTData.Misc.FiatConversionRate, 2);
double lastMonthProfitFiat = Math.Round((lastMonthProfit + lastMonthFunding) * Model.PTData.Misc.FiatConversionRate, 2);
double totalProfitFiat = Math.Round((totalProfit + totalFunding) * Model.PTData.Misc.FiatConversionRate, 2);
2023-12-30 06:46:45 +01:00
2024-01-07 22:53:49 +01:00
bool futuresFunding = Model.PropertiesData.IsLeverageExchange;
2023-12-30 06:46:45 +01:00
2019-01-14 04:09:58 +01:00
}
2018-05-22 10:11:50 +02:00
<table class="table table-sm">
<thead>
<tr>
<th></th>
<th class="text-right">Sales</th>
2024-01-15 15:12:46 +01:00
<th class="text-right">Profit @Model.PTData.Misc.Market</th>
2024-01-07 22:53:49 +01:00
@if (futuresFunding)
{
2024-01-19 00:11:16 +01:00
<th class="text-right">Funding</th>
2024-01-07 22:53:49 +01:00
}
<th class="text-right">@Model.PTData.Properties.Currency</th>
2024-01-16 17:56:52 +01:00
<th class="text-right">Gain</th>
2018-05-22 10:11:50 +02:00
</tr>
</thead>
<tbody>
<tr>
<th>Today</th>
2023-12-30 06:46:45 +01:00
<td class="text-right">@overviewStats.SalesToday</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@todaysProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
@if (futuresFunding)
{
<td class="text-right text-autocolor">@todaysFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
2023-12-30 06:46:45 +01:00
<td class="text-right text-autocolor">@Html.Raw(todaysProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2024-01-19 02:36:36 +01:00
<td class="text-right text-autocolor">@todaysPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) %</td>
2018-05-22 10:11:50 +02:00
</tr>
<tr>
<th>Yesterday</th>
2023-12-30 06:46:45 +01:00
<td class="text-right">@yesterdaysSales</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@yesterdaysProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
@if (futuresFunding)
{
<td class="text-right text-autocolor">@yesterdaysFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-16 17:56:52 +01:00
}
2023-12-30 06:46:45 +01:00
<td class="text-right text-autocolor">@Html.Raw(yesterdaysProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2024-01-19 02:36:36 +01:00
<td class="text-right text-autocolor">@yesterdaysPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) %</td>
2018-05-22 10:11:50 +02:00
</tr>
<tr>
2024-01-19 00:11:16 +01:00
<th>7 Days</th>
2023-12-30 06:46:45 +01:00
<td class="text-right">@last7DaysSales</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@last7DaysProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
@if (futuresFunding)
{
<td class="text-right text-autocolor">@last7DaysFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
2023-12-30 06:46:45 +01:00
<td class="text-right text-autocolor">@Html.Raw(last7DaysProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2024-01-19 02:36:36 +01:00
<td class="text-right text-autocolor">@last7DaysPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) %</td>
2018-05-22 10:11:50 +02:00
</tr>
2019-01-14 04:09:58 +01:00
<tr>
2024-01-19 00:11:16 +01:00
@{
var timeParts = @Model.MiscData.TimeZoneOffset.Split(':');
var timeZoneOffsetHours = int.Parse(timeParts[0]);
var timeZoneOffset = TimeSpan.FromHours(timeZoneOffsetHours);
var timeZoneInfo = TimeZoneInfo.CreateCustomTimeZone("Custom", timeZoneOffset, "Custom", "Custom");
var currentDateTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, timeZoneInfo);
var currentMonthName = currentDateTime.ToString("MMMM");
}
<th>@currentMonthName</th>
2024-01-07 22:53:49 +01:00
<td class="text-right">@thisMonthSales</td>
<td class="text-right text-autocolor">@thisMonthProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@thisMonthFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(thisMonthProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2024-01-19 02:36:36 +01:00
<td class="text-right text-autocolor">@thisMonthPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) %</td>
2024-01-07 22:53:49 +01:00
</tr>
<tr>
2024-01-19 00:11:16 +01:00
@{
var previousMonthDateTime = currentDateTime.AddMonths(-1);
var previousMonthName = previousMonthDateTime.ToString("MMMM");
}
<th>@previousMonthName</th>
2024-01-07 22:53:49 +01:00
<td class="text-right">@lastMonthSales</td>
<td class="text-right text-autocolor">@lastMonthProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
@if (futuresFunding)
{
<td class="text-right text-autocolor">@lastMonthFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
<td class="text-right text-autocolor">@Html.Raw(lastMonthProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2024-01-19 02:36:36 +01:00
<td class="text-right text-autocolor">@lastMonthPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) %</td>
2019-01-14 04:09:58 +01:00
</tr>
2018-05-22 10:11:50 +02:00
<tr>
<th>Total</th>
2023-12-30 06:46:45 +01:00
<td class="text-right">@totalSales</td>
2018-05-22 10:11:50 +02:00
<td class="text-right text-autocolor">@totalProfit.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
2024-01-07 22:53:49 +01:00
@if (futuresFunding)
{
<td class="text-right text-autocolor">@totalFunding.ToString("#,#0.00000000", new System.Globalization.CultureInfo("en-US"))</td>
}
2023-12-30 06:46:45 +01:00
<td class="text-right text-autocolor">@Html.Raw(totalProfitFiat.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")))</td>
2024-01-19 02:36:36 +01:00
<td class="text-right text-autocolor">@totalPercentGain.ToString("#,#0.00", new System.Globalization.CultureInfo("en-US")) %</td>
2018-05-22 10:11:50 +02:00
</tr>
</tbody>
</table>
</div>
</div>
</div>
2019-04-30 17:36:27 +02:00
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/d3/d3.min.js"></script>
<script src="@Html.Raw(Model.PTMagicConfiguration.GeneralSettings.Monitor.RootUrl)assets/plugins/nvd3/nv.d3.min.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>
2024-01-07 22:53:49 +01:00
2024-02-01 12:25:04 +01:00
<script type="text/javascript">
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
2019-04-30 17:36:27 +02:00
<script type="text/javascript">
2024-01-07 22:53:49 +01:00
$(document).ready(function () {
$(".cdev").circlos();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
var assetDistributionData; // Keep a reference to the data
@if (!Model.AssetDistributionData.Equals("")) {
<text>
nv.addGraph(function() {
assetDistributionChart = nv.models.pieChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.showLabels(true)
.labelThreshold(.1)
.labelType("percent")
.donut(true)
2024-01-23 19:05:28 +01:00
.donutRatio(0.3)
.margin({top: 10, bottom: 10})
.showLegend(false); // Hide the legend
2024-01-07 22:53:49 +01:00
assetDistributionData = @Html.Raw(Model.AssetDistributionData);
2024-01-30 10:38:19 +01:00
d3.select(".asset-distribution svg") // Change this line
2024-01-23 19:05:28 +01:00
.style('height', '90%')
.style('width', '100%')
2024-01-07 22:53:49 +01:00
.datum(assetDistributionData)
.transition().duration(0)
.call(assetDistributionChart);
2024-01-23 19:05:28 +01:00
2024-01-17 18:13:09 +01:00
nv.utils.windowResize(assetDistributionChart.update);
2024-01-07 22:53:49 +01:00
return assetDistributionChart;
2019-04-30 17:36:27 +02:00
});
2024-01-07 22:53:49 +01:00
</text>
}
});
</script>
2018-05-22 10:11:50 +02:00
2024-01-07 22:53:49 +01:00
<script type="text/javascript">
2018-05-22 10:11:50 +02:00
(function ($) {
'use strict';
2024-02-04 04:12:39 +01:00
// $('head').append('<style>.nv-point { stroke-width: 1px; }</style>');
2018-05-22 10:11:50 +02:00
$('[role="tooltip"]').remove();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
2024-01-07 22:53:49 +01:00
var trendChart; // Keep a reference to the chart
var trendData; // Keep a reference to the data
2019-04-30 17:36:27 +02:00
@if (!Model.TrendChartDataJSON.Equals("")) {
2024-01-07 22:53:49 +01:00
<text>
nv.addGraph(function () {
trendChart = nv.models.lineChart();
var height = 300;
trendChart.useInteractiveGuideline(true);
2024-02-04 04:12:39 +01:00
trendChart.pointSize(0.25); // Set the point size to a smaller value
2024-01-07 22:53:49 +01:00
trendChart.xAxis.tickFormat(function (d) { return d3.time.format('%H:%M')(new Date(d)); });
trendChart.yAxis.axisLabel('Trend %').tickFormat(d3.format(',.2f'));
trendData = @Html.Raw(Model.TrendChartDataJSON);
2024-01-30 10:38:19 +01:00
var svg = d3.select('.trend-chart svg').node();
d3.select(svg)
2024-01-07 22:53:49 +01:00
.datum(trendData)
.transition().duration(0)
.call(trendChart);
2024-01-13 20:10:44 +01:00
2024-01-30 10:38:19 +01:00
trendChart.dispatch.on('renderEnd', function() {
2024-02-01 12:25:04 +01:00
// Get the chart's container
var container = d3.select('.trend-chart .nv-wrap.nv-lineChart .nv-linesWrap');
2024-01-30 10:38:19 +01:00
2024-02-01 12:25:04 +01:00
// 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];
2024-01-30 10:38:19 +01:00
2024-02-01 12:25:04 +01:00
// 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
.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
});
2024-01-17 18:13:09 +01:00
nv.utils.windowResize(trendChart.update);
2024-01-07 22:53:49 +01:00
return trendChart;
2019-04-30 17:36:27 +02:00
});
2024-01-07 22:53:49 +01:00
</text>
2019-04-30 17:36:27 +02:00
}
2024-01-07 22:53:49 +01:00
})(jQuery);
</script>
<script type="text/javascript">
(function ($) {
'use strict';
$('[role="tooltip"]').remove();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
var profitChart; // Keep a reference to the chart
var profitData; // Keep a reference to the data
2024-02-01 12:25:04 +01:00
2024-01-07 22:53:49 +01:00
2019-04-30 17:36:27 +02:00
@if (!Model.ProfitChartDataJSON.Equals("")) {
2024-01-07 22:53:49 +01:00
<text>
nv.addGraph(function () {
profitChart = nv.models.lineChart();
var height = 300;
profitChart.useInteractiveGuideline(true);
2024-01-13 20:10:44 +01:00
profitChart.xAxis.tickFormat(function (d) { return d3.time.format('%m/%d')(new Date(d)); });
2024-01-07 22:53:49 +01:00
profitChart.yAxis.axisLabel('Daily Profit').tickFormat(d3.format(',.2f'));
profitData = @Html.Raw(Model.ProfitChartDataJSON);
d3.select('.profit-chart svg')
.datum(profitData)
.transition().duration(0)
.call(profitChart);
2024-01-13 20:10:44 +01:00
2024-01-30 10:38:19 +01:00
profitChart.dispatch.on('renderEnd', function() {
// Get the chart's container
var container = d3.select('.profit-chart .nv-wrap.nv-lineChart .nv-linesWrap');
2024-02-01 12:25:04 +01:00
// Remove any existing y=0 line
container.selectAll('.zero-line').remove();
2024-01-30 10:38:19 +01:00
// 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);
// Add a line at y=0
container.insert('line', ':first-child')
2024-02-01 12:25:04 +01:00
.attr('class', 'zero-line') // Add a class to the line for easy selection
2024-01-30 10:38:19 +01:00
.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
2024-02-01 12:25:04 +01:00
window.profitChartUpdate = nv.utils.windowResize(function() { profitChart.update(); });
2024-01-30 10:38:19 +01:00
}
2024-01-13 20:10:44 +01:00
});
2024-01-30 10:38:19 +01:00
2024-01-17 18:13:09 +01:00
nv.utils.windowResize(profitChart.update);
2024-01-07 22:53:49 +01:00
return profitChart;
2019-04-30 17:36:27 +02:00
});
2024-01-07 22:53:49 +01:00
</text>
2019-04-30 17:36:27 +02:00
}
2024-01-07 22:53:49 +01:00
})(jQuery);
2019-04-30 17:36:27 +02:00
</script>
2024-01-13 20:10:44 +01:00
2024-01-23 19:05:28 +01:00
<script type="text/javascript">
(function ($) {
'use strict';
$('[role="tooltip"]').remove();
$('[data-toggle="tooltip"]').tooltip();
$('.text-autocolor').autocolor(false);
var TCVLiveChart; // Keep a reference to the chart
var TCVLiveData; // Keep a reference to the data
@if (!Model.TotalCurrentValueLiveChartDataJSON.Equals("")) {
<text>
nv.addGraph(function () {
TCVLiveChart = nv.models.lineChart();
TCVLiveChart.useInteractiveGuideline(true);
TCVLiveChart.xAxis.tickFormat(function (d) { return d3.time.format('%H:%M:%S')(new Date(d)); });
TCVLiveChart.yAxis.axisLabel('').tickFormat(d3.format(',.2f'));
TCVLiveData = @Html.Raw(Model.TotalCurrentValueLiveChartDataJSON);
d3.select('.TCVLive-chart svg')
.style('width', '100%')
.datum(TCVLiveData)
.transition().duration(0)
.call(TCVLiveChart);
2024-01-30 10:38:19 +01:00
2024-01-23 19:05:28 +01:00
nv.utils.windowResize(TCVLiveChart.update);
return TCVLiveChart;
});
</text>
}
})(jQuery);
</script>
2024-01-30 10:38:19 +01:00
<script type="text/javascript">
2024-01-30 10:48:36 +01:00
function attachTooltipRemoval(chartClass) {
d3.selectAll(chartClass).on('mouseleave', function() {
var tooltip = d3.select(this).select('.nvtooltip');
if (!tooltip.empty()) {
tooltip.style('opacity', 0);
}
});
2024-01-30 10:38:19 +01:00
2024-01-30 10:48:36 +01:00
d3.selectAll(chartClass).on('mouseenter', function() {
var tooltip = d3.select(this).select('.nvtooltip');
if (!tooltip.empty()) {
tooltip.style('opacity', 1);
}
});
2024-01-30 10:38:19 +01:00
}
2024-01-30 10:48:36 +01:00
$(document).ready(function () {
// Hide all tooltips when the page is loaded
d3.selectAll('.nvtooltip').style('opacity', 0);
// Call the function for each chart
attachTooltipRemoval('.asset-distribution svg');
attachTooltipRemoval('.trend-chart svg');
attachTooltipRemoval('.profit-chart svg');
attachTooltipRemoval('.TCVLive-chart svg');
// Add other charts as needed
});
2024-01-30 10:38:19 +01:00
</script>
2024-02-01 12:25:04 +01:00
<script type="text/javascript">
window.cleanupData = function() {
TCVLiveChart = null;
TCVLiveData = null;
assetDistributionChart = null;
assetDistributionData = null;
trendChart = null;
trendData = null;
profitChart = null;
profitData = null;
};
</script>