source: branches/histogram/HeuristicLab.Analysis/3.3/DataVisualization/DataTableVisualProperties.cs @ 6014

Last change on this file since 6014 was 6014, checked in by abeham, 9 years ago

#1465

  • added option to set fixed minimum and maximum for all four possible axis
  • added an icon to the properties context menu entry
    • added dependency from ChartControlsExtensions to Common.Resources
File size: 14.6 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 HeuristicLab.Common;
24using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
25
26namespace HeuristicLab.Analysis {
27  /// <summary>
28  /// Visual properties of a DataTable.
29  /// </summary>
30  [StorableClass]
31  public class DataTableVisualProperties : DeepCloneable, INotifyPropertyChanged {
32    private string xAxisTitle;
33    public string XAxisTitle {
34      get { return xAxisTitle; }
35      set {
36        if (value == null) value = string.Empty;
37        if (xAxisTitle != value) {
38          xAxisTitle = value;
39          OnPropertyChanged("XAxisTitle");
40        }
41      }
42    }
43
44    private string yAxisTitle;
45    public string YAxisTitle {
46      get { return yAxisTitle; }
47      set {
48        if (value == null) value = string.Empty;
49        if (yAxisTitle != value) {
50          yAxisTitle = value;
51          OnPropertyChanged("YAxisTitle");
52        }
53      }
54    }
55
56    private string secondXAxisTitle;
57    public string SecondXAxisTitle {
58      get { return secondXAxisTitle; }
59      set {
60        if (value == null) value = string.Empty;
61        if (secondXAxisTitle != value) {
62          secondXAxisTitle = value;
63          OnPropertyChanged("SecondXAxisTitle");
64        }
65      }
66    }
67
68    private string secondYAxisTitle;
69    public string SecondYAxisTitle {
70      get { return secondYAxisTitle; }
71      set {
72        if (value == null) value = string.Empty;
73        if (secondYAxisTitle != value) {
74          secondYAxisTitle = value;
75          OnPropertyChanged("SecondYAxisTitle");
76        }
77      }
78    }
79
80    private bool xAxisMinimumAuto;
81    public bool XAxisMinimumAuto {
82      get { return xAxisMinimumAuto; }
83      set {
84        if (xAxisMinimumAuto != value) {
85          xAxisMinimumAuto = value;
86          if (value) xAxisMinimumFixedValue = double.NaN;
87          OnPropertyChanged("XAxisMinimumAuto");
88        }
89      }
90    }
91
92    private bool xAxisMaximumAuto;
93    public bool XAxisMaximumAuto {
94      get { return xAxisMaximumAuto; }
95      set {
96        if (xAxisMaximumAuto != value) {
97          xAxisMaximumAuto = value;
98          if (value) xAxisMaximumFixedValue = double.NaN;
99          OnPropertyChanged("XAxisMaximumAuto");
100        }
101      }
102    }
103
104    private double xAxisMinimumFixedValue;
105    public double XAxisMinimumFixedValue {
106      get { return xAxisMinimumFixedValue; }
107      set {
108        if (xAxisMinimumFixedValue != value) {
109          xAxisMinimumFixedValue = value;
110          OnPropertyChanged("XAxisMinimumFixedValue");
111        }
112      }
113    }
114
115    private double xAxisMaximumFixedValue;
116    public double XAxisMaximumFixedValue {
117      get { return xAxisMaximumFixedValue; }
118      set {
119        if (xAxisMaximumFixedValue != value) {
120          xAxisMaximumFixedValue = value;
121          OnPropertyChanged("XAxisMaximumFixedValue");
122        }
123      }
124    }
125
126    private bool secondXAxisMinimumAuto;
127    public bool SecondXAxisMinimumAuto {
128      get { return secondXAxisMinimumAuto; }
129      set {
130        if (secondXAxisMinimumAuto != value) {
131          secondXAxisMinimumAuto = value;
132          if (value) secondXAxisMinimumFixedValue = double.NaN;
133          OnPropertyChanged("SecondXAxisMinimumAuto");
134        }
135      }
136    }
137
138    private bool secondXAxisMaximumAuto;
139    public bool SecondXAxisMaximumAuto {
140      get { return secondXAxisMaximumAuto; }
141      set {
142        if (secondXAxisMaximumAuto != value) {
143          secondXAxisMaximumAuto = value;
144          if (value) secondXAxisMaximumFixedValue = double.NaN;
145          OnPropertyChanged("SecondXAxisMaximumAuto");
146        }
147      }
148    }
149
150    private double secondXAxisMinimumFixedValue;
151    public double SecondXAxisMinimumFixedValue {
152      get { return secondXAxisMinimumFixedValue; }
153      set {
154        if (secondXAxisMinimumFixedValue != value) {
155          secondXAxisMinimumFixedValue = value;
156          OnPropertyChanged("SecondXAxisMinimumFixedValue");
157        }
158      }
159    }
160
161    private double secondXAxisMaximumFixedValue;
162    public double SecondXAxisMaximumFixedValue {
163      get { return secondXAxisMaximumFixedValue; }
164      set {
165        if (secondXAxisMaximumFixedValue != value) {
166          secondXAxisMaximumFixedValue = value;
167          OnPropertyChanged("SecondXAxisMaximumFixedValue");
168        }
169      }
170    }
171
172    private bool yAxisMinimumAuto;
173    public bool YAxisMinimumAuto {
174      get { return yAxisMinimumAuto; }
175      set {
176        if (yAxisMinimumAuto != value) {
177          yAxisMinimumAuto = value;
178          if (value) yAxisMinimumFixedValue = double.NaN;
179          OnPropertyChanged("YAxisMinimumAuto");
180        }
181      }
182    }
183
184    private bool yAxisMaximumAuto;
185    public bool YAxisMaximumAuto {
186      get { return yAxisMaximumAuto; }
187      set {
188        if (yAxisMaximumAuto != value) {
189          yAxisMaximumAuto = value;
190          if (value) yAxisMaximumFixedValue = double.NaN;
191          OnPropertyChanged("YAxisMaximumAuto");
192        }
193      }
194    }
195
196    private double yAxisMinimumFixedValue;
197    public double YAxisMinimumFixedValue {
198      get { return yAxisMinimumFixedValue; }
199      set {
200        if (yAxisMinimumFixedValue != value) {
201          yAxisMinimumFixedValue = value;
202          OnPropertyChanged("YAxisMinimumFixedValue");
203        }
204      }
205    }
206
207    private double yAxisMaximumFixedValue;
208    public double YAxisMaximumFixedValue {
209      get { return yAxisMaximumFixedValue; }
210      set {
211        if (yAxisMaximumFixedValue != value) {
212          yAxisMaximumFixedValue = value;
213          OnPropertyChanged("YAxisMaximumFixedValue");
214        }
215      }
216    }
217
218    private bool secondYAxisMinimumAuto;
219    public bool SecondYAxisMinimumAuto {
220      get { return secondYAxisMinimumAuto; }
221      set {
222        if (secondYAxisMinimumAuto != value) {
223          secondYAxisMinimumAuto = value;
224          if (value) secondYAxisMinimumFixedValue = double.NaN;
225          OnPropertyChanged("SecondYAxisMinimumAuto");
226        }
227      }
228    }
229
230    private bool secondYAxisMaximumAuto;
231    public bool SecondYAxisMaximumAuto {
232      get { return secondYAxisMaximumAuto; }
233      set {
234        if (secondYAxisMaximumAuto != value) {
235          secondYAxisMaximumAuto = value;
236          if (value) secondYAxisMaximumFixedValue = double.NaN;
237          OnPropertyChanged("SecondYAxisMaximumAuto");
238        }
239      }
240    }
241
242    private double secondYAxisMinimumFixedValue;
243    public double SecondYAxisMinimumFixedValue {
244      get { return secondYAxisMinimumFixedValue; }
245      set {
246        if (secondYAxisMinimumFixedValue != value) {
247          secondYAxisMinimumFixedValue = value;
248          OnPropertyChanged("SecondYAxisMinimumFixedValue");
249        }
250      }
251    }
252
253    private double secondYAxisMaximumFixedValue;
254    public double SecondYAxisMaximumFixedValue {
255      get { return secondYAxisMaximumFixedValue; }
256      set {
257        if (secondYAxisMaximumFixedValue != value) {
258          secondYAxisMaximumFixedValue = value;
259          OnPropertyChanged("SecondYAxisMaximumFixedValue");
260        }
261      }
262    }
263
264    #region Persistence Properties
265    [Storable(Name = "XAxisTitle")]
266    private string StorableXAxisTitle {
267      get { return xAxisTitle; }
268      set { xAxisTitle = value; }
269    }
270    [Storable(Name = "YAxisTitle")]
271    private string StorableYAxisTitle {
272      get { return yAxisTitle; }
273      set { yAxisTitle = value; }
274    }
275    [Storable(Name = "SecondXAxisTitle")]
276    private string StorableSecondXAxisTitle {
277      get { return secondXAxisTitle; }
278      set { secondXAxisTitle = value; }
279    }
280    [Storable(Name = "SecondYAxisTitle")]
281    private string StorableSecondYAxisTitle {
282      get { return secondYAxisTitle; }
283      set { secondYAxisTitle = value; }
284    }
285    [Storable(Name = "XAxisMinimumAuto")]
286    private bool StorableXAxisMinimumAuto {
287      get { return xAxisMinimumAuto; }
288      set { xAxisMinimumAuto = value; }
289    }
290    [Storable(Name = "XAxisMaximumAuto")]
291    private bool StorableXAxisMaximumAuto {
292      get { return xAxisMaximumAuto; }
293      set { xAxisMaximumAuto = value; }
294    }
295    [Storable(Name = "XAxisMinimumFixedValue")]
296    private double StorableXAxisMinimumFixedValue {
297      get { return xAxisMinimumFixedValue; }
298      set { xAxisMinimumFixedValue = value; }
299    }
300    [Storable(Name = "XAxisMaximumFixedValue")]
301    private double StorableXAxisMaximumFixedValue {
302      get { return xAxisMaximumFixedValue; }
303      set { xAxisMaximumFixedValue = value; }
304    }
305    [Storable(Name = "SecondXAxisMinimumAuto")]
306    private bool StorableSecondXAxisMinimumAuto {
307      get { return secondXAxisMinimumAuto; }
308      set { secondXAxisMinimumAuto = value; }
309    }
310    [Storable(Name = "SecondXAxisMaximumAuto")]
311    private bool StorableSecondXAxisMaximumAuto {
312      get { return secondXAxisMaximumAuto; }
313      set { secondXAxisMaximumAuto = value; }
314    }
315    [Storable(Name = "SecondXAxisMinimumFixedValue")]
316    private double StorableSecondXAxisMinimumFixedValue {
317      get { return secondXAxisMinimumFixedValue; }
318      set { secondXAxisMinimumFixedValue = value; }
319    }
320    [Storable(Name = "SecondXAxisMaximumFixedValue")]
321    private double StorableSecondXAxisMaximumFixedValue {
322      get { return secondXAxisMaximumFixedValue; }
323      set { secondXAxisMaximumFixedValue = value; }
324    }
325    [Storable(Name = "YAxisMinimumAuto")]
326    private bool StorableYAxisMinimumAuto {
327      get { return yAxisMinimumAuto; }
328      set { yAxisMinimumAuto = value; }
329    }
330    [Storable(Name = "YAxisMaximumAuto")]
331    private bool StorableYAxisMaximumAuto {
332      get { return yAxisMaximumAuto; }
333      set { yAxisMaximumAuto = value; }
334    }
335    [Storable(Name = "YAxisMinimumFixedValue")]
336    private double StorableYAxisMinimumFixedValue {
337      get { return yAxisMinimumFixedValue; }
338      set { yAxisMinimumFixedValue = value; }
339    }
340    [Storable(Name = "YAxisMaximumFixedValue")]
341    private double StorableYAxisMaximumFixedValue {
342      get { return yAxisMaximumFixedValue; }
343      set { yAxisMaximumFixedValue = value; }
344    }
345    [Storable(Name = "SecondYAxisMinimumAuto")]
346    private bool StorableSecondYAxisMinimumAuto {
347      get { return secondYAxisMinimumAuto; }
348      set { secondYAxisMinimumAuto = value; }
349    }
350    [Storable(Name = "SecondYAxisMaximumAuto")]
351    private bool StorableSecondYAxisMaximumAuto {
352      get { return secondYAxisMaximumAuto; }
353      set { secondYAxisMaximumAuto = value; }
354    }
355    [Storable(Name = "SecondYAxisMinimumFixedValue")]
356    private double StorableSecondYAxisMinimumFixedValue {
357      get { return secondYAxisMinimumFixedValue; }
358      set { secondYAxisMinimumFixedValue = value; }
359    }
360    [Storable(Name = "SecondYAxisMaximumFixedValue")]
361    private double StorableSecondYAxisMaximumFixedValue {
362      get { return secondYAxisMaximumFixedValue; }
363      set { secondYAxisMaximumFixedValue = value; }
364    }
365    #endregion
366
367    [StorableConstructor]
368    protected DataTableVisualProperties(bool deserializing) : base() { }
369    protected DataTableVisualProperties(DataTableVisualProperties original, Cloner cloner)
370      : base(original, cloner) {
371      this.xAxisTitle = original.xAxisTitle;
372      this.yAxisTitle = original.yAxisTitle;
373      this.secondXAxisTitle = original.secondXAxisTitle;
374      this.secondYAxisTitle = original.secondYAxisTitle;
375      this.xAxisMinimumAuto = original.xAxisMinimumAuto;
376      this.xAxisMinimumFixedValue = original.xAxisMinimumFixedValue;
377      this.xAxisMaximumAuto = original.xAxisMaximumAuto;
378      this.xAxisMaximumFixedValue = original.xAxisMaximumFixedValue;
379      this.secondXAxisMinimumAuto = original.secondXAxisMinimumAuto;
380      this.secondXAxisMinimumFixedValue = original.secondXAxisMinimumFixedValue;
381      this.secondXAxisMaximumAuto = original.secondXAxisMaximumAuto;
382      this.secondXAxisMaximumFixedValue = original.secondXAxisMaximumFixedValue;
383      this.yAxisMinimumAuto = original.yAxisMinimumAuto;
384      this.yAxisMinimumFixedValue = original.yAxisMinimumFixedValue;
385      this.yAxisMaximumAuto = original.yAxisMaximumAuto;
386      this.yAxisMaximumFixedValue = original.yAxisMaximumFixedValue;
387      this.secondYAxisMinimumAuto = original.secondYAxisMinimumAuto;
388      this.secondYAxisMinimumFixedValue = original.secondYAxisMinimumFixedValue;
389      this.secondYAxisMaximumAuto = original.secondYAxisMaximumAuto;
390      this.secondYAxisMaximumFixedValue = original.secondYAxisMaximumFixedValue;
391    }
392    public DataTableVisualProperties() {
393      this.xAxisTitle = string.Empty;
394      this.yAxisTitle = string.Empty;
395      this.secondXAxisTitle = string.Empty;
396      this.secondYAxisTitle = string.Empty;
397      this.xAxisMinimumAuto = true;
398      this.xAxisMinimumFixedValue = double.NaN;
399      this.xAxisMaximumAuto = true;
400      this.xAxisMaximumFixedValue = double.NaN;
401      this.secondXAxisMinimumAuto = true;
402      this.secondXAxisMinimumFixedValue = double.NaN;
403      this.secondXAxisMaximumAuto = true;
404      this.secondXAxisMaximumFixedValue = double.NaN;
405      this.yAxisMinimumAuto = true;
406      this.yAxisMinimumFixedValue = double.NaN;
407      this.yAxisMaximumAuto = true;
408      this.yAxisMaximumFixedValue = double.NaN;
409      this.secondYAxisMinimumAuto = true;
410      this.secondYAxisMinimumFixedValue = double.NaN;
411      this.secondYAxisMaximumAuto = true;
412      this.secondYAxisMaximumFixedValue = double.NaN;
413    }
414
415    public override IDeepCloneable Clone(Cloner cloner) {
416      return new DataTableVisualProperties(this, cloner);
417    }
418
419    public event PropertyChangedEventHandler PropertyChanged;
420    protected virtual void OnPropertyChanged(string propertyName) {
421      PropertyChangedEventHandler handler = PropertyChanged;
422      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
423    }
424  }
425}
Note: See TracBrowser for help on using the repository browser.