Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.Analysis/3.3/DataVisualization/DataRowVisualProperties.cs @ 18078

Last change on this file since 18078 was 17181, checked in by swagner, 5 years ago

#2875: Merged r17180 from trunk to stable

File size: 8.7 KB
RevLine 
[4644]1#region License Information
2/* HeuristicLab
[17181]3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
[4644]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
[6628]22using System;
[4644]23using System.ComponentModel;
[4722]24using System.Drawing;
[4644]25using HeuristicLab.Common;
[17097]26using HEAL.Attic;
[4644]27
28namespace HeuristicLab.Analysis {
29  /// <summary>
30  /// Visual properties of a DataRow.
31  /// </summary>
[17097]32  [StorableType("3B28F24F-5CA7-40C2-A81C-65FCAF5B2C66")]
[4644]33  public class DataRowVisualProperties : DeepCloneable, INotifyPropertyChanged {
34    #region ChartType
[17097]35    [StorableType("488A018F-AF79-4B60-989A-845EF24F4A01")]
[4644]36    public enum DataRowChartType {
37      Line,
38      Columns,
39      Points,
[6342]40      Bars,
[7297]41      Histogram,
42      StepLine
[4644]43    }
[17097]44
[4644]45    #endregion
[6342]46    #region LineStyle
[17097]47    [StorableType("A064C2CE-D2CC-4292-B5FC-8DDCFA55C896")]
[6342]48    public enum DataRowLineStyle {
49      Dash,
50      DashDot,
51      DashDotDot,
52      Dot,
53      NotSet,
54      Solid
55    }
56    #endregion
[4644]57
58    private DataRowChartType chartType;
59    public DataRowChartType ChartType {
60      get { return chartType; }
61      set {
62        if (chartType != value) {
63          chartType = value;
64          OnPropertyChanged("ChartType");
65        }
66      }
67    }
68    private bool secondYAxis;
69    public bool SecondYAxis {
70      get { return secondYAxis; }
71      set {
72        if (secondYAxis != value) {
73          secondYAxis = value;
74          OnPropertyChanged("SecondYAxis");
75        }
76      }
77    }
[6342]78    private bool secondXAxis;
79    public bool SecondXAxis {
80      get { return secondXAxis; }
81      set {
82        if (secondXAxis != value) {
83          secondXAxis = value;
84          OnPropertyChanged("SecondXAxis");
85        }
86      }
87    }
[4648]88    private Color color;
89    public Color Color {
90      get { return color; }
91      set {
92        if (color != value) {
93          color = value;
94          OnPropertyChanged("Color");
95        }
96      }
97    }
[6342]98    private DataRowLineStyle lineStyle;
99    public DataRowLineStyle LineStyle {
100      get { return lineStyle; }
101      set {
102        if (lineStyle != value) {
103          lineStyle = value;
104          OnPropertyChanged("LineStyle");
105        }
106      }
107    }
[4648]108    private bool startIndexZero;
109    public bool StartIndexZero {
110      get { return startIndexZero; }
111      set {
112        if (startIndexZero != value) {
113          startIndexZero = value;
114          OnPropertyChanged("StartIndexZero");
115        }
116      }
117    }
[6342]118    private int lineWidth;
119    public int LineWidth {
120      get { return lineWidth; }
121      set {
122        if (lineWidth != value) {
123          lineWidth = value;
124          OnPropertyChanged("LineWidth");
125        }
126      }
127    }
[15097]128
[6978]129    private double scaleFactor;
130    public double ScaleFactor {
131      get { return scaleFactor; }
132      set {
133        if (scaleFactor != value) {
134          scaleFactor = value;
135          OnPropertyChanged("ScaleFactor");
136        }
137      }
138    }
[7124]139    private bool isVisibleInLegend;
140    public bool IsVisibleInLegend {
141      get { return isVisibleInLegend; }
142      set {
143        if (isVisibleInLegend != value) {
144          isVisibleInLegend = value;
145          OnPropertyChanged("IsVisibleInLegend");
146        }
147      }
148    }
[6628]149    private string displayName;
150    public string DisplayName {
151      get { return displayName == null ? String.Empty : displayName; }
152      set {
153        if (displayName != value) {
154          if (value == null && displayName != String.Empty) {
155            displayName = String.Empty;
156            OnPropertyChanged("DisplayName");
157          } else if (value != null) {
158            displayName = value;
159            OnPropertyChanged("DisplayName");
160          }
161        }
162      }
163    }
[4644]164
[4648]165    #region Persistence Properties
166    [Storable(Name = "ChartType")]
167    private DataRowChartType StorableChartType {
168      get { return chartType; }
169      set { chartType = value; }
170    }
171    [Storable(Name = "SecondYAxis")]
172    private bool StorableSecondYAxis {
173      get { return secondYAxis; }
174      set { secondYAxis = value; }
175    }
[6342]176    [Storable(Name = "SecondXAxis")]
177    private bool StorableSecondXAxis {
178      get { return secondXAxis; }
179      set { secondXAxis = value; }
180    }
[4648]181    [Storable(Name = "Color")]
182    private Color StorableColor {
183      get { return color; }
184      set { color = value; }
185    }
[6342]186    [Storable(Name = "LineStyle")]
187    private DataRowLineStyle StorableLineStyle {
188      get { return lineStyle; }
189      set { lineStyle = value; }
190    }
[4648]191    [Storable(Name = "StartIndexZero")]
192    private bool StorableStartIndexZero {
193      get { return startIndexZero; }
194      set { startIndexZero = value; }
195    }
[6342]196    [Storable(Name = "LineWidth")]
197    private int StorableLineWidth {
198      get { return lineWidth; }
199      set { lineWidth = value; }
200    }
[6978]201    [Storable(Name = "ScaleFactor")]
202    private double StorableScaleFactor {
203      get { return scaleFactor; }
204      set { scaleFactor = value; }
205    }
[7126]206    [Storable(Name = "IsVisibleInLegend", DefaultValue = true)]
[7124]207    private bool StorableIsVisibleInLegend {
208      get { return isVisibleInLegend; }
209      set { isVisibleInLegend = value; }
210    }
[6628]211    [Storable(Name = "DisplayName")]
212    private string StorableDisplayName {
213      get { return displayName; }
214      set { displayName = value; }
215    }
[4648]216    #endregion
217
[15097]218    #region Histogram Properties - Backwards Compatability
219    internal enum DataRowHistogramAggregation {
220      Overlapping,
221      SideBySide,
222      Stacked
223    }
224
225    internal int? Bins { get; private set; }
226    internal bool? ExactBins { get; private set; }
227    internal DataRowHistogramAggregation? Aggregation { get; private set; }
228
[17105]229    [Storable(OldName = "Bins")]
[15097]230    private int StorableBins { set { Bins = value; } }
[17105]231    [Storable(OldName = "ExactBins")]
[15097]232    private bool StorableExactBins { set { ExactBins = value; } }
[17105]233    [Storable(OldName = "Aggregation")]
[15097]234    private DataRowHistogramAggregation StorableAggregation { set { Aggregation = value; } }
235    #endregion
236
[4722]237    [StorableConstructor]
[17097]238    protected DataRowVisualProperties(StorableConstructorFlag _) { }
[4722]239    protected DataRowVisualProperties(DataRowVisualProperties original, Cloner cloner)
240      : base(original, cloner) {
241      this.chartType = original.chartType;
242      this.secondYAxis = original.secondYAxis;
[6342]243      this.secondXAxis = original.secondXAxis;
[4722]244      this.color = original.color;
[6342]245      this.lineStyle = original.lineStyle;
[4722]246      this.startIndexZero = original.startIndexZero;
[6342]247      this.lineWidth = original.lineWidth;
[6978]248      this.scaleFactor = original.scaleFactor;
[6628]249      this.displayName = original.displayName;
[7124]250      this.isVisibleInLegend = original.isVisibleInLegend;
[4722]251    }
[4644]252    public DataRowVisualProperties() {
253      chartType = DataRowChartType.Line;
254      secondYAxis = false;
[6342]255      secondXAxis = false;
[4648]256      color = Color.Empty;
[6342]257      lineStyle = DataRowLineStyle.Solid;
[4648]258      startIndexZero = false;
[6342]259      lineWidth = 1;
[6978]260      scaleFactor = 1.0;
[6628]261      displayName = String.Empty;
[7124]262      isVisibleInLegend = true;
[4644]263    }
[6628]264    public DataRowVisualProperties(string displayName)
265      : this() {
266      this.displayName = displayName;
267    }
[4644]268
[4777]269    public override IDeepCloneable Clone(Cloner cloner) {
270      return new DataRowVisualProperties(this, cloner);
271    }
272
[4644]273    public event PropertyChangedEventHandler PropertyChanged;
274    protected virtual void OnPropertyChanged(string propertyName) {
275      PropertyChangedEventHandler handler = PropertyChanged;
276      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
277    }
[6676]278
279    [StorableHook(HookType.AfterDeserialization)]
280    private void AfterDeserialization() {
281      // BackwardsCompatibility3.3
282      #region Backwards compatible code, remove with 3.4
283      if (secondXAxis == default(bool)
284        && lineStyle == default(DataRowLineStyle)
285        && displayName == default(string)) {
286        secondXAxis = false;
287        lineStyle = DataRowLineStyle.Solid;
288        lineWidth = 1;
289        displayName = String.Empty;
290      }
291      #endregion
292    }
[4644]293  }
294}
Note: See TracBrowser for help on using the repository browser.