Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 4670 was 4648, checked in by swagner, 14 years ago

Worked on flexible coloring of data rows and on changing the initial index from 1 to 0 (#925)

File size: 4.1 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 HeuristicLab.Common;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25using System.Drawing;
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    public DataRowVisualProperties() {
107      chartType = DataRowChartType.Line;
108      secondYAxis = false;
109      color = Color.Empty;
110      startIndexZero = false;
111    }
112    public DataRowVisualProperties(DataRowChartType chartType, bool secondYAxis, Color color, bool startIndexZero) {
113      this.chartType = chartType;
114      this.secondYAxis = secondYAxis;
115      this.color = color;
116      this.startIndexZero = startIndexZero;
117    }
118    [StorableConstructor]
119    protected DataRowVisualProperties(bool deserializing) { }
120
121    public override IDeepCloneable Clone(Cloner cloner) {
122      DataRowVisualProperties clone = (DataRowVisualProperties)base.Clone(cloner);
123      clone.chartType = chartType;
124      clone.secondYAxis = secondYAxis;
125      clone.color = color;
126      clone.startIndexZero = startIndexZero;
127      return clone;
128    }
129
130    public event PropertyChangedEventHandler PropertyChanged;
131    protected virtual void OnPropertyChanged(string propertyName) {
132      PropertyChangedEventHandler handler = PropertyChanged;
133      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
134    }
135  }
136}
Note: See TracBrowser for help on using the repository browser.