public void Update() { var lastRawIncomeTime = rawManager.GetLast().time; ////Day Start//// var currentDay = UnixTimeHelper.GetCurrentDay(); dayIncome = rawManager.GetLast().value - rawManager.GetRow(currentDay).value; var recentIncome = manager.GetLast().value; var penultimateIncome = manager.GetPenultimate().value; dayTrend = recentIncome / penultimateIncome - 1; var lastDayIncomeArray = rawManager.GetInvertSlice(lastRawIncomeTime - 86400); var lastDayAmountArray = lastDayIncomeArray.Select(r => r.value).ToArray(); dayAver = StatisticHelper.GetAverageSpeed(lastDayAmountArray, 86400); dayExpected = StatisticHelper.GetMedianSpeed(lastDayAmountArray, 86400); ////Day End//// ////Week Start//// var weekDayIncome = manager.GetIncome(7); weekIncome = weekDayIncome; var twoWeekDayIncome = manager.GetIncome(14); var weeksDiff = twoWeekDayIncome - weekDayIncome; weekTrend = (weeksDiff > 0) ? weekDayIncome / weeksDiff - 1 : 0.0; var weekIncomeArray = rawManager.GetInvertSlice(lastRawIncomeTime - 604800); var weekIncomeAmountArray = weekIncomeArray.Select(r => r.value).ToArray(); weekAver = StatisticHelper.GetAverageSpeed(weekIncomeAmountArray, 604800); weekExpected = StatisticHelper.GetMedianSpeed(weekIncomeAmountArray, 604800); ////Week End//// ////Total Start//// var allIncome = manager.GetAll().Select(d => d.value); totalIncome = allIncome.Sum(); totalTrend = StatisticHelper.GetGlobalTrend(allIncome.ToArray()); ////Total End//// }
private void UpdatePlot(DayIncomeManager dayIncomeManager, PaymentManager paymentManager) { UpdateDayIncomePlot(dayIncomeManager.GetAll()); UpdatePaymentPlot(dayIncomeManager, paymentManager.GetAll()); BasePlot.UpdatePlot(); }