source: trunk/sources/HeuristicLab.Analysis/3.3/DataRowVisualProperties.cs @ 4777

Last change on this file since 4777 was 4777, checked in by swagner, 9 years ago

Worked on flexible row coloring for data rows (#925)

File size: 4.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 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    }
40    #endregion
41
42    private DataRowChartType chartType;
43    public DataRowChartType ChartType {
44      get { return chartType; }
45      set {
46        if (chartType != value) {
47          chartType = value;
48          OnPropertyChanged("ChartType");
49        }
50      }
51    }
52    private bool secondYAxis;
53    public bool SecondYAxis {
54      get { return secondYAxis; }
55      set {
56        if (secondYAxis != value) {
57          secondYAxis = value;
58          OnPropertyChanged("SecondYAxis");
59        }
60      }
61    }
62    private Color color;
63    public Color Color {
64      get { return color; }
65      set {
66        if (color != value) {
67          color = value;
68          OnPropertyChanged("Color");
69        }
70      }
71    }
72    private bool startIndexZero;
73    public bool StartIndexZero {
74      get { return startIndexZero; }
75      set {
76        if (startIndexZero != value) {
77          startIndexZero = value;
78          OnPropertyChanged("StartIndexZero");
79        }
80      }
81    }
82
83    #region Persistence Properties
84    [Storable(Name = "ChartType")]
85    private DataRowChartType StorableChartType {
86      get { return chartType; }
87      set { chartType = value; }
88    }
89    [Storable(Name = "SecondYAxis")]
90    private bool StorableSecondYAxis {
91      get { return secondYAxis; }
92      set { secondYAxis = value; }
93    }
94    [Storable(Name = "Color")]
95    private Color StorableColor {
96      get { return color; }
97      set { color = value; }
98    }
99    [Storable(Name = "StartIndexZero")]
100    private bool StorableStartIndexZero {
101      get { return startIndexZero; }
102      set { startIndexZero = value; }
103    }
104    #endregion
105
106    [StorableConstructor]
107    protected DataRowVisualProperties(bool deserializing) : base() { }
108    protected DataRowVisualProperties(DataRowVisualProperties original, Cloner cloner)
109      : base(original, cloner) {
110      this.chartType = original.chartType;
111      this.secondYAxis = original.secondYAxis;
112      this.color = original.color;
113      this.startIndexZero = original.startIndexZero;
114    }
115    public DataRowVisualProperties() {
116      chartType = DataRowChartType.Line;
117      secondYAxis = false;
118      color = Color.Empty;
119      startIndexZero = false;
120    }
121    public DataRowVisualProperties(DataRowChartType chartType, bool secondYAxis, Color color, bool startIndexZero) {
122      this.chartType = chartType;
123      this.secondYAxis = secondYAxis;
124      this.color = color;
125      this.startIndexZero = startIndexZero;
126    }
127
128    public override IDeepCloneable Clone(Cloner cloner) {
129      return new DataRowVisualProperties(this, cloner);
130    }
131
132    public event PropertyChangedEventHandler PropertyChanged;
133    protected virtual void OnPropertyChanged(string propertyName) {
134      PropertyChangedEventHandler handler = PropertyChanged;
135      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
136    }
137  }
138}
Note: See TracBrowser for help on using the repository browser.