A data storage class to store one single plot on a two dimensional graph. Where the x axis is a Date line and the y axis is a monetary amount.
コード例 #1
0
        /// <summary>
        ///     Analyses the specified ledger and assigns graph data
        /// </summary>
        public void Analyse([NotNull] LedgerBucket ledger, [NotNull] LedgerBook book)
        {
            if (ledger == null)
            {
                throw new ArgumentNullException(nameof(ledger));
            }

            if (book == null)
            {
                throw new ArgumentNullException(nameof(book));
            }

            GraphData = new GraphData
            {
                GraphName = "Bucket Balance History"
            };

            var series = new SeriesData
            {
                Description = "The actual bank balance of the Ledger Bucket over time.",
                SeriesName = "Balance"
            };
            GraphData.SeriesList.Add(series);

            foreach (var reconciliation in book.Reconciliations.Take(24).Reverse())
            {
                var entry = reconciliation.Entries.FirstOrDefault(e => e.LedgerBucket == ledger);
                var plot = new DatedGraphPlot
                {
                    Date = reconciliation.Date,
                    Amount = entry?.Balance ?? 0
                };
                series.PlotsList.Add(plot);
            }
        }
コード例 #2
0
        /// <summary>
        ///     Analyses the specified ledger and assigns graph data
        /// </summary>
        public void Analyse([NotNull] LedgerBucket ledger, [NotNull] LedgerBook book)
        {
            if (ledger == null)
            {
                throw new ArgumentNullException(nameof(ledger));
            }

            if (book == null)
            {
                throw new ArgumentNullException(nameof(book));
            }

            GraphData = new GraphData
            {
                GraphName = "Bucket Balance History"
            };

            var series = new SeriesData
            {
                Description = "The actual bank balance of the Ledger Bucket over time.",
                SeriesName  = "Balance"
            };

            GraphData.SeriesList.Add(series);

            foreach (var reconciliation in book.Reconciliations.Take(24).Reverse())
            {
                var entry = reconciliation.Entries.FirstOrDefault(e => e.LedgerBucket == ledger);
                var plot  = new DatedGraphPlot
                {
                    Date   = reconciliation.Date,
                    Amount = entry?.Balance ?? 0
                };
                series.PlotsList.Add(plot);
            }
        }