Exemplo n.º 1
0
 void SaveData(SprintData data)
 {
     using (var fs = File.OpenWrite("data.xml"))
     {
         new DataContractSerializer(typeof(SprintData)).WriteObject(fs, data);
         fs.SetLength(fs.Position);
     }
 }
Exemplo n.º 2
0
        void Render(SprintData data)
        {
            var model = new PlotModel
            {
                Title = data.Name,
                Axes  =
                {
                    new CategoryAxis {
                        Title = "Day", Position = AxisPosition.Bottom
                    },
                    new LinearAxis
                    {
                        Title              = "Points",
                        Position           = AxisPosition.Left,
                        MinorGridlineStyle = LineStyle.Solid,
                        MajorGridlineStyle = LineStyle.Solid,
                        MinimumPadding     = 0.0,
                        MaximumPadding     = 0.1
                    }
                },
                IsLegendVisible = true,
                LegendPlacement = LegendPlacement.Outside
            };
            var sustain = new SprintCheckpoint
            {
                Done  = 0,
                Total = data.Checkpoints.Select(c => c.Total).LastOrDefault()
            };
            var days            = data.Checkpoints.Concat(Enumerable.Repeat(sustain, data.Duration - data.Checkpoints.Count));
            var completedSeries = new ColumnSeries {
                Title = "Done"
            };

            foreach (var day in days)
            {
                completedSeries.Items.Add(new ColumnItem(day.Done));
            }
            model.Series.Add(completedSeries);
            var totalSeries = new LineSeries {
                Title = "Scope"
            };
            var i = 0;

            foreach (var day in days)
            {
                totalSeries.Points.Add(new DataPoint(i++, day.Total));
            }
            model.Series.Add(totalSeries);
            this.plot.Model = model;
        }