Free cookie consent management tool by TermsFeed Policy Generator

source: branches/histogram/HeuristicLab.Analysis/3.3/DataVisualization/DataRowVisualProperties.cs @ 6012

Last change on this file since 6012 was 6012, checked in by abeham, 13 years ago

#1465

  • fine tuned UI for setting data(table|row) visual properties
  • added control for the data table visual properties
  • added a few more visual properties
File size: 6.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2011 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 System.ComponentModel;
23using System.Drawing;
24using HeuristicLab.Common;
25using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
26
27namespace HeuristicLab.Analysis {
28  /// <summary>
29  /// Visual properties of a DataRow.
30  /// </summary>
31  [StorableClass]
32  public class DataRowVisualProperties : DeepCloneable, INotifyPropertyChanged {
33    #region ChartType
34    public enum DataRowChartType {
35      Line,
36      Columns,
37      Points,
38      Bars,
39      Histogram
40    }
41    #endregion
42    #region LineStyle
43    public enum DataRowLineStyle {
44      Dash,
45      DashDot,
46      DashDotDot,
47      Dot,
48      NotSet,
49      Solid
50    }
51    #endregion
52
53    private DataRowChartType chartType;
54    public DataRowChartType ChartType {
55      get { return chartType; }
56      set {
57        if (chartType != value) {
58          chartType = value;
59          OnPropertyChanged("ChartType");
60        }
61      }
62    }
63    private bool secondYAxis;
64    public bool SecondYAxis {
65      get { return secondYAxis; }
66      set {
67        if (secondYAxis != value) {
68          secondYAxis = value;
69          OnPropertyChanged("SecondYAxis");
70        }
71      }
72    }
73    private bool secondXAxis;
74    public bool SecondXAxis {
75      get { return secondXAxis; }
76      set {
77        if (secondXAxis != value) {
78          secondXAxis = value;
79          OnPropertyChanged("SecondXAxis");
80        }
81      }
82    }
83    private Color color;
84    public Color Color {
85      get { return color; }
86      set {
87        if (color != value) {
88          color = value;
89          OnPropertyChanged("Color");
90        }
91      }
92    }
93    private DataRowLineStyle lineStyle;
94    public DataRowLineStyle LineStyle {
95      get { return lineStyle; }
96      set {
97        if (lineStyle != value) {
98          lineStyle = value;
99          OnPropertyChanged("LineStyle");
100        }
101      }
102    }
103    private bool startIndexZero;
104    public bool StartIndexZero {
105      get { return startIndexZero; }
106      set {
107        if (startIndexZero != value) {
108          startIndexZero = value;
109          OnPropertyChanged("StartIndexZero");
110        }
111      }
112    }
113    private int lineWidth;
114    public int LineWidth {
115      get { return lineWidth; }
116      set {
117        if (lineWidth != value) {
118          lineWidth = value;
119          OnPropertyChanged("LineWidth");
120        }
121      }
122    }
123    private int bins;
124    public int Bins {
125      get { return bins; }
126      set {
127        if (bins != value) {
128          bins = value;
129          OnPropertyChanged("Bins");
130        }
131      }
132    }
133    private bool exactBins;
134    public bool ExactBins {
135      get { return exactBins; }
136      set {
137        if (exactBins != value) {
138          exactBins = value;
139          OnPropertyChanged("ExactBins");
140        }
141      }
142    }
143
144    #region Persistence Properties
145    [Storable(Name = "ChartType")]
146    private DataRowChartType StorableChartType {
147      get { return chartType; }
148      set { chartType = value; }
149    }
150    [Storable(Name = "SecondYAxis")]
151    private bool StorableSecondYAxis {
152      get { return secondYAxis; }
153      set { secondYAxis = value; }
154    }
155    [Storable(Name = "SecondXAxis")]
156    private bool StorableSecondXAxis {
157      get { return secondXAxis; }
158      set { secondXAxis = value; }
159    }
160    [Storable(Name = "Color")]
161    private Color StorableColor {
162      get { return color; }
163      set { color = value; }
164    }
165    [Storable(Name = "LineStyle")]
166    private DataRowLineStyle StorableLineStyle {
167      get { return lineStyle; }
168      set { lineStyle = value; }
169    }
170    [Storable(Name = "StartIndexZero")]
171    private bool StorableStartIndexZero {
172      get { return startIndexZero; }
173      set { startIndexZero = value; }
174    }
175    [Storable(Name = "LineWidth")]
176    private int StorableLineWidth {
177      get { return lineWidth; }
178      set { lineWidth = value; }
179    }
180    [Storable(Name = "Bins")]
181    private int StorableBins {
182      get { return bins; }
183      set { bins = value; }
184    }
185    [Storable(Name = "ExactBins")]
186    private bool StorableExactBins {
187      get { return exactBins; }
188      set { exactBins = value; }
189    }
190    #endregion
191
192    [StorableConstructor]
193    protected DataRowVisualProperties(bool deserializing) : base() { }
194    protected DataRowVisualProperties(DataRowVisualProperties original, Cloner cloner)
195      : base(original, cloner) {
196      this.chartType = original.chartType;
197      this.secondYAxis = original.secondYAxis;
198      this.secondXAxis = original.secondXAxis;
199      this.color = original.color;
200      this.lineStyle = original.lineStyle;
201      this.startIndexZero = original.startIndexZero;
202      this.lineWidth = original.lineWidth;
203      this.bins = original.bins;
204      this.exactBins = original.exactBins;
205    }
206    public DataRowVisualProperties() {
207      chartType = DataRowChartType.Line;
208      secondYAxis = false;
209      secondXAxis = false;
210      color = Color.Empty;
211      lineStyle = DataRowLineStyle.Solid;
212      startIndexZero = false;
213      lineWidth = 1;
214      bins = 10;
215      exactBins = false;
216    }
217
218    public override IDeepCloneable Clone(Cloner cloner) {
219      return new DataRowVisualProperties(this, cloner);
220    }
221
222    public event PropertyChangedEventHandler PropertyChanged;
223    protected virtual void OnPropertyChanged(string propertyName) {
224      PropertyChangedEventHandler handler = PropertyChanged;
225      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
226    }
227  }
228}
Note: See TracBrowser for help on using the repository browser.