Beispiel #1
0
        public void CompareTotalAccidents(List <Report> reports)
        {
            double reportsWithAccidents = reports.FindAll(r => r.Accidents > 0).Count;


            double accidentsPerc = Math.Round((reportsWithAccidents / reports.Count) * 100);

            LiveCharts.WinForms.SolidGauge solidGauge = new LiveCharts.WinForms.SolidGauge
            {
                From  = 0,
                To    = 100,
                Value = accidentsPerc
            };
            solidGauge.LabelFormatter        = val => val + " %";
            solidGauge.Base.LabelsVisibility = System.Windows.Visibility.Hidden;
            solidGauge.Base.GaugeActiveFill  = new LinearGradientBrush
            {
                GradientStops = new System.Windows.Media.GradientStopCollection
                {
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.Yellow, 0),
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.Orange, .5),
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.Red, 1)
                }
            };
            GenerateChartLabel("Total Simulations With Accidents", new Point(550, 320));
            AddChartToForm(solidGauge, new Point(550, 360));
        }
Beispiel #2
0
        public void SimulationsCountAccidents()
        {
            double accidentsPerc = Math.Round((data.GetSimulationsWithAccidentsCount() / data.GetSimulationsCount()) * 100);

            LiveCharts.WinForms.SolidGauge solidGauge = new LiveCharts.WinForms.SolidGauge
            {
                From  = 0,
                To    = 100,
                Value = accidentsPerc
            };
            solidGauge.LabelFormatter        = val => val + " %";
            solidGauge.Base.LabelsVisibility = System.Windows.Visibility.Hidden;
            solidGauge.Base.GaugeActiveFill  = new LinearGradientBrush
            {
                GradientStops = new System.Windows.Media.GradientStopCollection
                {
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.Yellow, 0),
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.Orange, .5),
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.Red, 1)
                }
            };
            GenerateChartLabel("Total Simulations With Accidents", new Point(550, 340));
            AddChartToForm(solidGauge, new Point(550, 380));
        }
Beispiel #3
0
        public void SimulationsCountCarsLeft()
        {
            double carsLeftPerc = Math.Round((data.GetCarsLeft() / data.GetCarsEntered()) * 100);

            LiveCharts.WinForms.SolidGauge solidGauge = new LiveCharts.WinForms.SolidGauge
            {
                From  = 0,
                To    = 100,
                Value = carsLeftPerc
            };
            solidGauge.LabelFormatter        = val => val + " %";
            solidGauge.Base.LabelsVisibility = System.Windows.Visibility.Hidden;
            solidGauge.Base.GaugeActiveFill  = new LinearGradientBrush
            {
                GradientStops = new System.Windows.Media.GradientStopCollection
                {
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.Black, 0),
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.DarkGreen, .5),
                    new System.Windows.Media.GradientStop(System.Windows.Media.Colors.LightGreen, 1)
                }
            };
            GenerateChartLabel("Total Cars Left", new Point(100, 340));
            AddChartToForm(solidGauge, new Point(100, 380));
        }