Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 6011 was 6011, checked in by abeham, 14 years ago

#1465

  • updated branch with changes from trunk
  • fixed some bugs
  • introduced secondary x-axis option
File size: 5.3 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
43    private DataRowChartType chartType;
44    public DataRowChartType ChartType {
45      get { return chartType; }
46      set {
47        if (chartType != value) {
48          chartType = value;
49          OnPropertyChanged("ChartType");
50        }
51      }
52    }
53    private bool secondYAxis;
54    public bool SecondYAxis {
55      get { return secondYAxis; }
56      set {
57        if (secondYAxis != value) {
58          secondYAxis = value;
59          OnPropertyChanged("SecondYAxis");
60        }
61      }
62    }
63    private bool secondXAxis;
64    public bool SecondXAxis {
65      get { return secondXAxis; }
66      set {
67        if (secondXAxis != value) {
68          secondXAxis = value;
69          OnPropertyChanged("SecondXAxis");
70        }
71      }
72    }
73    private Color color;
74    public Color Color {
75      get { return color; }
76      set {
77        if (color != value) {
78          color = value;
79          OnPropertyChanged("Color");
80        }
81      }
82    }
83    private bool startIndexZero;
84    public bool StartIndexZero {
85      get { return startIndexZero; }
86      set {
87        if (startIndexZero != value) {
88          startIndexZero = value;
89          OnPropertyChanged("StartIndexZero");
90        }
91      }
92    }
93    private int bins;
94    public int Bins {
95      get { return bins; }
96      set {
97        if (bins != value) {
98          bins = value;
99          OnPropertyChanged("Bins");
100        }
101      }
102    }
103    private bool exactBins;
104    public bool ExactBins {
105      get { return exactBins; }
106      set {
107        if (exactBins != value) {
108          exactBins = value;
109          OnPropertyChanged("ExactBins");
110        }
111      }
112    }
113
114    #region Persistence Properties
115    [Storable(Name = "ChartType")]
116    private DataRowChartType StorableChartType {
117      get { return chartType; }
118      set { chartType = value; }
119    }
120    [Storable(Name = "SecondYAxis")]
121    private bool StorableSecondYAxis {
122      get { return secondYAxis; }
123      set { secondYAxis = value; }
124    }
125    [Storable(Name = "SecondXAxis")]
126    private bool StorableSecondXAxis {
127      get { return secondXAxis; }
128      set { secondXAxis = value; }
129    }
130    [Storable(Name = "Color")]
131    private Color StorableColor {
132      get { return color; }
133      set { color = value; }
134    }
135    [Storable(Name = "StartIndexZero")]
136    private bool StorableStartIndexZero {
137      get { return startIndexZero; }
138      set { startIndexZero = value; }
139    }
140    [Storable(Name = "Bins")]
141    private int StorableBins {
142      get { return bins; }
143      set { bins = value; }
144    }
145    [Storable(Name = "ExactBins")]
146    private bool StorableExactBins {
147      get { return exactBins; }
148      set { exactBins = value; }
149    }
150    #endregion
151
152    [StorableConstructor]
153    protected DataRowVisualProperties(bool deserializing) : base() { }
154    protected DataRowVisualProperties(DataRowVisualProperties original, Cloner cloner)
155      : base(original, cloner) {
156      this.chartType = original.chartType;
157      this.secondYAxis = original.secondYAxis;
158      this.secondXAxis = original.secondXAxis;
159      this.color = original.color;
160      this.startIndexZero = original.startIndexZero;
161      this.bins = original.bins;
162      this.exactBins = original.exactBins;
163    }
164    public DataRowVisualProperties() {
165      chartType = DataRowChartType.Line;
166      secondYAxis = false;
167      secondXAxis = false;
168      color = Color.Empty;
169      startIndexZero = false;
170      bins = 10;
171      exactBins = false;
172    }
173
174    public override IDeepCloneable Clone(Cloner cloner) {
175      return new DataRowVisualProperties(this, cloner);
176    }
177
178    public event PropertyChangedEventHandler PropertyChanged;
179    protected virtual void OnPropertyChanged(string propertyName) {
180      PropertyChangedEventHandler handler = PropertyChanged;
181      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
182    }
183  }
184}
Note: See TracBrowser for help on using the repository browser.