Пример #1
0
        private async Task GenerateGlobalMessageCountChart()
        {
            // Breaks the method into an async method so it can work in peace and be awaited.
            await Task.Delay(1).ConfigureAwait(false);

            var data =
                Data.StatsByTypeAndSecond.
                ToList().
                Select(x => new
            {
                IsReader = x.Key,
                Points   = x.Value.OrderBy(y => y.Key).Select(y => new DataPoint(y.Key, y.Sum(z => z.ProcessedMessages))).ToList(),
            }).
                ToList();

            lock (GlobalMessageCountPlot.SyncRoot)
            {
                GlobalMessageCountPlot.Series.Clear();

                foreach (var entry in data)
                {
                    LineSeries series = new LineSeries {
                        Title = entry.IsReader ? "Read" : "Write",
                    };
                    series.Points.AddRange(entry.Points);

                    GlobalMessageCountPlot.Series.Add(series);
                }
            }

            GlobalMessageCountPlot.InvalidatePlot(true);
        }
Пример #2
0
 private void ResetGlobalMessageCountPlotButton_ClickHandler(object sender, RoutedEventArgs e)
 {
     GlobalMessageCountPlot.ResetAllAxes();
 }