示例#1
0
 void GenerateProjectData(ref ChartJsData chartJsData, IEnumerable <ProjectData> datas)
 {
     foreach (var data in datas)
     {
         chartJsData.Data.Add(data.Name, data.TimeSpan.TotalHours);
     }
 }
示例#2
0
        ChartJsData GenerateCommonData(DataAnalyzer.DataType dataType, string name)
        {
            var chartJsData = new ChartJsData();

            chartJsData.DataName = name;

            GenerateProjectData(ref chartJsData, dataAnalyzer.Get(dataType).OrderByDescending(x => x.TotalSeconds));

            return(chartJsData);
        }
示例#3
0
        ChartJsData GenerateProjectsList()
        {
            var chartJsData = new ChartJsData();

            chartJsData.DataName = "projectsData";

            var data = dataAnalyzer.GetProjects().OrderByDescending(m => m.TotalSeconds).Cast <ProjectData>();

            GenerateProjectData(ref chartJsData, data);

            return(chartJsData);
        }
示例#4
0
        ChartJsData GenerateBestDay()
        {
            var startDate = dataAnalyzer.GetStartDate();
            var endDate   = dataAnalyzer.GetEndDate();

            var chartJsData = new ChartJsData();

            chartJsData.DataName = "bestDayData";

            for (int year = startDate.Year; year <= endDate.Year; year++)
            {
                var bestDay = dataAnalyzer.GetBestDay(new DateTime(year, 1, 1), new DateTime(year, 12, 31));

                chartJsData.Data.Add(year.ToString(), bestDay.GrandTotal.TimeSpan.TotalHours);
            }

            return(chartJsData);
        }
示例#5
0
        ChartJsData GenerateDailyAverage()
        {
            var startDate = dataAnalyzer.GetStartDate();
            var endDate   = dataAnalyzer.GetEndDate();

            var chartJsData = new ChartJsData();

            chartJsData.DataName = "averageData";

            chartJsData.Data.Add("All time", dataAnalyzer.GetDailyAverage().TotalHours);

            for (int year = startDate.Year; year <= endDate.Year; year++)
            {
                var total = dataAnalyzer.GetDailyAverage(new DateTime(year, 1, 1), new DateTime(year, 12, 31));

                chartJsData.Data.Add(year.ToString(), total.TotalHours);
            }

            return(chartJsData);
        }