コード例 #1
0
ファイル: JsonSchedule.cs プロジェクト: corydeppen/ScrumTime
        public JsonSchedule(List<Release> releases, List<Sprint> sprints, 
            DateTime startDateRange, DateTime endDateRange)
            : base()
        {
            Data = new List<object>();
            YAxisTicks = new List<string>();
            SetXAxisTickIntervalDays(startDateRange, endDateRange);
            Series = new List<object>();

            int sprintIndex = sprints.Count();
            if (sprintIndex > 0)
            {
                foreach (Sprint sprint in sprints)
                {
                    Data.Add(CreateSprintJsonList(sprintIndex, sprint, startDateRange, endDateRange));
                    Series.Add(new JsonDataSeriesSprintElement() { lineWidth = 3, showMarker = false,
                        label = "Sprint " + sprint.Name });
                    sprintIndex--;
                }

                var descendingSprints = from s in sprints
                                    orderby s.StartDate descending
                                    select s;
                // the YAxis ticks need to be listed in reverse order

                foreach (Sprint sprint in descendingSprints)
                {
                    YAxisTicks.Add(sprint.Name);
                }
            }

            foreach (Release release in releases)
            {
                Data.Add(CreateReleaseJsonList(sprints.Count(), release));
                Series.Add(new JsonDataSeriesReleaseElement() { lineWidth = 6, showMarker = false,
                    label = "Release " + release.Name, color = "#ff4444", showLabel = true });
            }

            JsonDataSeriesPointLabelsElement pointLabels = new JsonDataSeriesPointLabelsElement()
            {
                hideZeros = true, labelsFromSeries = true
            };
            JsonDataSeriesPointElement seriesPoint = new JsonDataSeriesPointElement()
            {
                pointLabels = pointLabels
            };
            Series.Add(seriesPoint);

            if (sprints.Count() == 0)
            {
                YAxisTicks.Add(" ");  // a bit of a hack to allow the schedule to display...forces data to be present
                Data.Add(CreateSprintJsonList(1, startDateRange.AddYears(-50),
                    startDateRange.AddYears(-50), startDateRange, endDateRange));
            }
        }
コード例 #2
0
        public JsonSchedule(List <Release> releases, List <Sprint> sprints,
                            DateTime startDateRange, DateTime endDateRange) : base()
        {
            Data       = new List <object>();
            YAxisTicks = new List <string>();
            SetXAxisTickIntervalDays(startDateRange, endDateRange);
            Series = new List <object>();

            int sprintIndex = sprints.Count();

            if (sprintIndex > 0)
            {
                foreach (Sprint sprint in sprints)
                {
                    Data.Add(CreateSprintJsonList(sprintIndex, sprint, startDateRange, endDateRange));
                    Series.Add(new JsonDataSeriesSprintElement()
                    {
                        lineWidth = 3, showMarker = false,
                        label     = "Sprint " + sprint.Name
                    });
                    sprintIndex--;
                }

                var descendingSprints = from s in sprints
                                        orderby s.StartDate descending
                                        select s;
                // the YAxis ticks need to be listed in reverse order

                foreach (Sprint sprint in descendingSprints)
                {
                    YAxisTicks.Add(sprint.Name);
                }
            }

            foreach (Release release in releases)
            {
                Data.Add(CreateReleaseJsonList(sprints.Count(), release));
                Series.Add(new JsonDataSeriesReleaseElement()
                {
                    lineWidth = 6, showMarker = false,
                    label     = "Release " + release.Name, color = "#ff4444", showLabel = true
                });
            }

            JsonDataSeriesPointLabelsElement pointLabels = new JsonDataSeriesPointLabelsElement()
            {
                hideZeros = true, labelsFromSeries = true
            };
            JsonDataSeriesPointElement seriesPoint = new JsonDataSeriesPointElement()
            {
                pointLabels = pointLabels
            };

            Series.Add(seriesPoint);

            if (sprints.Count() == 0)
            {
                YAxisTicks.Add(" ");  // a bit of a hack to allow the schedule to display...forces data to be present
                Data.Add(CreateSprintJsonList(1, startDateRange.AddYears(-50),
                                              startDateRange.AddYears(-50), startDateRange, endDateRange));
            }
        }