Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PerformanceComparison/HeuristicLab.Analysis/3.3/DataVisualization/ScatterPlotDataRowVisualProperties.cs @ 13722

Last change on this file since 13722 was 13722, checked in by abeham, 9 years ago

#2457:

  • Renamed remaining files from ExpertSystem to KnowledgeCenter
  • Added ability to scatter plot to display a regression line
  • Allowed to execute multiple instances at once and displaying either only final result or tracking result
  • Split runs in seeded runs and instance runs
File size: 5.6 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using HeuristicLab.Common;
23using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
24using System;
25using System.ComponentModel;
26using System.Drawing;
27
28namespace HeuristicLab.Analysis {
29  /// <summary>
30  /// Visual properties of a ScatterPlotDataRow.
31  /// </summary>
32  [StorableClass]
33  public class ScatterPlotDataRowVisualProperties : DeepCloneable, INotifyPropertyChanged {
34    #region PointStyle
35    public enum ScatterPlotDataRowPointStyle {
36      Circle,
37      Cross,
38      Diamond,
39      Square,
40      Star4,
41      Star5,
42      Star6,
43      Star10,
44      Triangle
45    }
46    #endregion
47
48    private Color color;
49    public Color Color {
50      get { return color; }
51      set {
52        if (color != value) {
53          color = value;
54          OnPropertyChanged("Color");
55        }
56      }
57    }
58    private ScatterPlotDataRowPointStyle pointStyle;
59    public ScatterPlotDataRowPointStyle PointStyle {
60      get { return pointStyle; }
61      set {
62        if (pointStyle != value) {
63          pointStyle = value;
64          OnPropertyChanged("PointStyle");
65        }
66      }
67    }
68    private int pointSize;
69    public int PointSize {
70      get { return pointSize; }
71      set {
72        if (pointSize != value) {
73          pointSize = value;
74          OnPropertyChanged("PointSize");
75        }
76      }
77    }
78    private bool isVisibleInLegend;
79    public bool IsVisibleInLegend {
80      get { return isVisibleInLegend; }
81      set {
82        if (isVisibleInLegend != value) {
83          isVisibleInLegend = value;
84          OnPropertyChanged("IsVisibleInLegend");
85        }
86      }
87    }
88    private string displayName;
89    public string DisplayName {
90      get { return displayName == null ? String.Empty : displayName; }
91      set {
92        if (displayName != value) {
93          if (value == null && displayName != String.Empty) {
94            displayName = String.Empty;
95            OnPropertyChanged("DisplayName");
96          } else if (value != null) {
97            displayName = value;
98            OnPropertyChanged("DisplayName");
99          }
100        }
101      }
102    }
103    private bool showRegressionLine;
104    public bool ShowRegressionLine {
105      get { return showRegressionLine; }
106      set {
107        if (showRegressionLine == value) return;
108        showRegressionLine = value;
109        OnPropertyChanged("ShowRegressionLine");
110      }
111    }
112
113    #region Persistence Properties
114    [Storable(Name = "Color")]
115    private Color StorableColor {
116      get { return color; }
117      set { color = value; }
118    }
119    [Storable(Name = "PointStyle")]
120    private ScatterPlotDataRowPointStyle StorablePointStyle {
121      get { return pointStyle; }
122      set { pointStyle = value; }
123    }
124    [Storable(Name = "PointSize")]
125    private int StorablePointSize {
126      get { return pointSize; }
127      set { pointSize = value; }
128    }
129    [Storable(Name = "IsVisibleInLegend")]
130    private bool StorableIsVisibleInLegend {
131      get { return isVisibleInLegend; }
132      set { isVisibleInLegend = value; }
133    }
134    [Storable(Name = "DisplayName")]
135    private string StorableDisplayName {
136      get { return displayName; }
137      set { displayName = value; }
138    }
139    [Storable(Name = "ShowRegressionLine")]
140    private bool StorableShowRegressionLine {
141      get { return showRegressionLine; }
142      set { showRegressionLine = value; }
143    }
144    #endregion
145
146    [StorableConstructor]
147    protected ScatterPlotDataRowVisualProperties(bool deserializing) : base() { }
148    protected ScatterPlotDataRowVisualProperties(ScatterPlotDataRowVisualProperties original, Cloner cloner)
149      : base(original, cloner) {
150      this.color = original.color;
151      this.pointStyle = original.pointStyle;
152      this.pointSize = original.pointSize;
153      this.displayName = original.displayName;
154      this.isVisibleInLegend = original.isVisibleInLegend;
155      this.showRegressionLine = original.showRegressionLine;
156    }
157    public ScatterPlotDataRowVisualProperties() {
158      color = Color.Empty;
159      pointStyle = ScatterPlotDataRowPointStyle.Circle;
160      pointSize = 3;
161      displayName = String.Empty;
162      isVisibleInLegend = true;
163      showRegressionLine = false;
164    }
165    public ScatterPlotDataRowVisualProperties(string displayName)
166      : this() {
167      this.displayName = displayName;
168    }
169
170    public override IDeepCloneable Clone(Cloner cloner) {
171      return new ScatterPlotDataRowVisualProperties(this, cloner);
172    }
173
174    public event PropertyChangedEventHandler PropertyChanged;
175    protected virtual void OnPropertyChanged(string propertyName) {
176      PropertyChangedEventHandler handler = PropertyChanged;
177      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
178    }
179  }
180}
Note: See TracBrowser for help on using the repository browser.