aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/RealTimeGraphX-master/RealTimeGraphX.WPF/WpfGraphDataSeries.cs
blob: 8eab3eabed1106d2b072f1b26c881ecb1a38fbe2 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace RealTimeGraphX.WPF
{
    /// <summary>
    /// Represents a WPF <see cref="IGraphDataSeries">data series</see>.
    /// </summary>
    /// <seealso cref="RealTimeGraphX.GraphObject" />
    /// <seealso cref="RealTimeGraphX.IGraphDataSeries" />
    public class WpfGraphDataSeries : GraphObject, IGraphDataSeries
    {
        #region Internal Properties

        /// <summary>
        /// Gets the GDI stroke color.
        /// </summary>
        internal System.Drawing.Color GdiStroke { get; private set; }

        /// <summary>
        /// Gets the GDI fill brush.
        /// </summary>
        internal System.Drawing.Brush GdiFill { get; private set; }

        /// <summary>
        /// Gets or sets the GDI pen.
        /// </summary>
        internal System.Drawing.Pen GdiPen { get; set; }

        #endregion

        private String _name;
        /// <summary>
        /// Gets or sets the series name.
        /// </summary>
        public String Name
        {
            get { return _name; }
            set { _name = value; RaisePropertyChangedAuto(); }
        }

        private float _strokeThickness;
        /// <summary>
        /// Gets or sets the stroke thickness.
        /// </summary>
        public float StrokeThickness
        {
            get
            {
                return _strokeThickness;
            }
            set
            {
                _strokeThickness = value;
                GdiPen = new System.Drawing.Pen(GdiStroke, _strokeThickness);
                RaisePropertyChangedAuto();
            }
        }

        private bool _isVisible;
        /// <summary>
        /// Gets or sets a value indicating whether this series should be visible.
        /// </summary>
        public bool IsVisible
        {
            get { return _isVisible; }
            set { _isVisible = value; RaisePropertyChangedAuto(); }
        }

        private Color _stroke;
        /// <summary>
        /// Gets or sets the series stroke color.
        /// </summary>
        public Color Stroke
        {
            get { return _stroke; }
            set
            {
                _stroke = value;
                RaisePropertyChangedAuto();

                if (_stroke != null)
                {
                    GdiStroke = _stroke.ToGdiColor();
                    GdiPen = new System.Drawing.Pen(GdiStroke, StrokeThickness);
                }
                else
                {
                    GdiStroke = System.Drawing.Color.Transparent;
                }
            }
        }

        private Brush _fill;
        /// <summary>
        /// Gets or sets the series fill brush.
        /// </summary>
        public Brush Fill
        {
            get { return _fill; }
            set
            {
                _fill = value;
                RaisePropertyChangedAuto();

                if (_fill != null)
                {
                    GdiFill = _fill.ToGdiBrush();
                }
                else
                {
                    GdiFill = null;
                }
            }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="WpfGraphDataSeries"/> class.
        /// </summary>
        public WpfGraphDataSeries()
        {
            StrokeThickness = 1;
            IsVisible = true;
            Stroke = Colors.DodgerBlue;
        }

        /// <summary>
        /// Gets or sets a value indicating whether to fill the series.
        /// </summary>
        public bool UseFill
        {
            get { return Fill != null; }
        }

        private object _currentValue;
        /// <summary>
        /// Gets the current value.
        /// </summary>
        public object CurrentValue
        {
            get { return _currentValue; }
            set { _currentValue = value; RaisePropertyChangedAuto(); }
        }
    }
}