示例#1
0
        /// <summary>
        /// return map with reporting countries for a list of years
        /// [year][count]
        /// </summary>
        public static Dictionary <int, int> GetReportingYears()
        {
            Dictionary <int, int> yearContries = new Dictionary <int, int>();
            var reportingyears = ListOfValues.ReportingYears(true);

            foreach (var v in reportingyears)
            {
                yearContries.Add(v.Year, v.Countries.HasValue ? v.Countries.Value : 0);
            }
            return(yearContries);
        }
示例#2
0
        /// <summary>
        /// Fills in missing reporting years.
        /// </summary>
        public static IEnumerable <TimeSeriesUtils.BarData> InsertMissingYears(IEnumerable <TimeSeriesUtils.BarData> data, bool includeEPER)
        {
            IEnumerable <REPORTINGYEAR> years = ListOfValues.ReportingYears(includeEPER);

            IEnumerable <TimeSeriesUtils.BarData> bars = from y in years
                                                         join c in data on y.Year equals c.Year into g
                                                         from c in g.DefaultIfEmpty()
                                                         orderby y.Year
                                                         select new TimeSeriesUtils.BarData
            {
                Year    = y.Year,
                Values  = c != null ? c.Values : null,
                ToolTip = c != null ? c.ToolTip : null
            };

            return(bars);
        }