aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/AnalyserResultChartData.cs
blob: 54431968f81c57c923492f592582613b205bdf6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using OxyPlot;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core;

namespace Tango.DispenserAnalyzer.UI.Analysis
{
    public class AnalyzerResultChartData : ExtendedObject
    {
        public ObservableCollection<DataPoint> Points { get; set; }

        public string Title { get; set; }

        private int _step;
        public int XStep
        {
            get { return _step; }
            set { _step = value; RaisePropertyChangedAuto(); }
        }

        private double _fromXAxis;
        public double FromXAxis
        {
            get { return _fromXAxis; }
            set { _fromXAxis = value; RaisePropertyChangedAuto(); }
        }

        private double _toXAxis;
        public double ToXAxis
        {
            get { return _toXAxis; }
            set { _toXAxis = value; RaisePropertyChangedAuto(); }
        }

        private double _fromYAxis;
        public double FromYAxis
        {
            get { return _fromYAxis; }
            set { _fromYAxis = value; RaisePropertyChangedAuto(); }
        }

        private double _toYAxis;
        public double ToYAxis
        {
            get { return _toYAxis; }
            set { _toYAxis = value; RaisePropertyChangedAuto(); }
        }

        public void UpdateData()
        {
            _toYAxis = Points.Max(x => x.Y) + 2;
            _fromYAxis = Points.Min(x => x.Y) - 1;
            _toXAxis = Points.Max(x => x.X);
            _fromXAxis = Points.Min(x => x.X);

            RaisePropertyChanged("Title");
            RaisePropertyChanged("Points");
        }

        public AnalyzerResultChartData()
        {
            Points = new ObservableCollection<DataPoint>();
            _fromYAxis = 0;
            _fromXAxis = 0;
            _toYAxis = 1;
            _toXAxis = 1;
            XStep = 1;
        }
    }
}