using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; namespace RealTimeGraphX.WPF { /// /// Represents a WPF data series. /// /// /// public class WpfGraphDataSeries : GraphObject, IGraphDataSeries { #region Internal Properties /// /// Gets the GDI stroke color. /// internal System.Drawing.Color GdiStroke { get; private set; } /// /// Gets the GDI fill brush. /// internal System.Drawing.Brush GdiFill { get; private set; } /// /// Gets or sets the GDI pen. /// internal System.Drawing.Pen GdiPen { get; set; } #endregion private String _name; /// /// Gets or sets the series name. /// public String Name { get { return _name; } set { _name = value; RaisePropertyChangedAuto(); } } private float _strokeThickness; /// /// Gets or sets the stroke thickness. /// public float StrokeThickness { get { return _strokeThickness; } set { _strokeThickness = value; GdiPen = new System.Drawing.Pen(GdiStroke, _strokeThickness); RaisePropertyChangedAuto(); } } private bool _isVisible; /// /// Gets or sets a value indicating whether this series should be visible. /// public bool IsVisible { get { return _isVisible; } set { _isVisible = value; RaisePropertyChangedAuto(); } } private Color _stroke; /// /// Gets or sets the series stroke color. /// 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; /// /// Gets or sets the series fill brush. /// public Brush Fill { get { return _fill; } set { _fill = value; RaisePropertyChangedAuto(); if (_fill != null) { GdiFill = _fill.ToGdiBrush(); } else { GdiFill = null; } } } /// /// Initializes a new instance of the class. /// public WpfGraphDataSeries() { StrokeThickness = 1; IsVisible = true; Stroke = Colors.DodgerBlue; } /// /// Gets or sets a value indicating whether to fill the series. /// public bool UseFill { get { return Fill != null; } } private object _currentValue; /// /// Gets the current value. /// public object CurrentValue { get { return _currentValue; } set { _currentValue = value; RaisePropertyChangedAuto(); } } } }