예제 #1
0
        public void ShowByCandidates(VotingResults votingResults, Func <Vote, bool> filter)
        {
            lock (_plotModel.SyncRoot)
            {
                _xAxis.SetAxisMinMax(TimeSpanAxis.ToDouble(votingResults.StartTime), TimeSpanAxis.ToDouble(votingResults.EndTime));

                _plotModel.Series.Clear();

                var candidates = votingResults.Votes.Where(x => filter(x)).Select(x => x.CandidateId).Distinct();

                int max = 0;
                foreach (var candidate in candidates)
                {
                    LineSeries series = TotalCumulativeVotedByTimeUtils.CreateSeries(votingResults, x => filter(x) && (x.CandidateId == candidate), out int total);
                    if (total > max)
                    {
                        max = total;
                    }
                    series.Title = votingResults.Candidates[candidate].Name;
                    _plotModel.Series.Add(series);
                }
                _yAxis.SetAxisMax(max);
            }
            _plotModel.InvalidatePlot(true);
        }
예제 #2
0
        public void Show(VotingResults votingResults, Func <Vote, bool> filter)
        {
            lock (_plotModel.SyncRoot)
            {
                _xAxis.SetAxisMinMax(TimeSpanAxis.ToDouble(votingResults.StartTime), TimeSpanAxis.ToDouble(votingResults.EndTime));

                _plotModel.Series.Clear();

                LineSeries series = TotalCumulativeVotedByTimeUtils.CreateSeries(votingResults, filter, out var max);
                series.Title = "Всего проголосовало";
                _yAxis.SetAxisMax(max);
                _plotModel.Series.Add(series);
            }
            _plotModel.InvalidatePlot(true);
        }