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">
2021-01-25 13:30:06 +01:00
<div class="col-md-5 px-1">
2024-01-16 17:56:52 +01:00
<div class="card-box px-2" style="height:340px;">
2024-01-19 02:36:36 +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 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
2020-07-15 12:04:37 +02:00
<div class="col-md-3 px-1">
2024-01-16 17:56:52 +01:00
<div class="card-box px-3" style="height:340px;">
2024-01-19 00:11:16 +01:00
<div class="cdev" data-percent="100" data-duration="@Html.Raw(@Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds * 1000)" data-color="#aaa,#414d59"
title="All charts set to refresh every @Model.PTMagicConfiguration.GeneralSettings.Monitor.RefreshSeconds seconds in your general settings."></div>
2019-05-04 05:52:07 +02:00
@{
2020-07-17 13:35:43 +02: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"));
2019-05-04 05:52:07 +02:00
}
2020-07-21 23:29:07 +02:00
}
<div id="AssetDistribution" class="container">
2020-07-22 06:14:57 +02:00
<div class="text-center">
<small>
2024-01-15 15:12:46 +01:00
<span data-toggle="tooltip" data-placement="top" title="Starting balance from PTM settings">Start: <text class="text-autocolor"> @Model.MiscData.StartBalance @Model.Summary.MainMarket </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>
2020-07-22 06:14:57 +02:00
</small>
</div>
<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>
2020-07-21 23:29:07 +02:00
</div>
<div class="row px1">
<svg style="height:260px;width:100%"></svg>
2020-07-15 12:04:37 +02:00
</div>
2019-05-01 09:19:37 +02:00
</div>
</div>
</div>
2020-07-26 16:28:37 +02:00
2021-01-25 13:30:06 +01:00
<div class="col-md-4 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-19 02:36:36 +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.ProfitDays 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-19 02:36:36 +01:00
<h4 class="m-t-0 m-b-20 header-title">Live Trends
<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.RefreshSeconds seconds in general settings."></i>
<small class="pull-right" style="font-size: x-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-19 02:36:36 +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 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
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 assetDistributionChart; // Keep a reference to the chart
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)
.donutRatio(0.3);
assetDistributionData = @Html.Raw(Model.AssetDistributionData);
2019-04-30 17:36:27 +02:00
d3.select("#AssetDistribution svg")
2024-01-07 22:53:49 +01:00
.datum(assetDistributionData)
.transition().duration(0)
.call(assetDistributionChart);
2024-01-13 20:10:44 +01:00
// 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);
}
});
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';
$('[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);
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);
d3.select('.trend-chart svg')
.datum(trendData)
.transition().duration(0)
.call(trendChart);
2024-01-13 20:10:44 +01:00
// 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);
}
});
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
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
// 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);
}
});
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
<script type="text/javascript">
$(document).ready(function(){
var originalLeave = $.fn.tooltip.Constructor.prototype.leave;
$.fn.tooltip.Constructor.prototype.leave = function(obj){
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type);
var container, timeout;
originalLeave.call(this, obj);
if(obj.currentTarget) {
container = $(obj.currentTarget).siblings('.tooltip');
timeout = self.timeout;
container.one('mouseenter', function(){
//We entered the actual tooltip – call off the dogs
clearTimeout(timeout);
//Let's monitor tooltip content instead
container.one('mouseleave', function(){
$.fn.tooltip.Constructor.prototype.leave.call(self, self);
});
});
}
};
$('[data-toggle="tooltip"]').tooltip();
});
</script>