source: branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs @ 14467

Last change on this file since 14467 was 14467, checked in by pfleck, 4 years ago

#2709

  • Removed some groupboxes in ViewShortcutListView.
  • Removed unnecessary IViewChartShortcut
  • Split ScatterPlot Multi and Single in to separate contents.
  • Renamed Color-combo box in Scatterplot to "Group".
File size: 3.2 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2016 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.Collections.Generic;
23using System.Drawing;
24using HeuristicLab.Analysis;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27using HeuristicLab.Data;
28
29namespace HeuristicLab.DataPreprocessing {
30  [Item("PreprocessingChart", "Represents a preprocessing chart.")]
31  public class PreprocessingChartContent : Item, IViewShortcut {
32    public static new Image StaticItemImage {
33      get { return HeuristicLab.Common.Resources.VSImageLibrary.PieChart; }
34    }
35
36    private ICheckedItemList<StringValue> variableItemList = null;
37    public ICheckedItemList<StringValue> VariableItemList {
38      get { return this.variableItemList; }
39      set { this.variableItemList = value; }
40    }
41
42    public IFilteredPreprocessingData PreprocessingData { get; private set; }
43
44    public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData) {
45      PreprocessingData = preprocessingData;
46    }
47
48    public PreprocessingChartContent(PreprocessingChartContent content, Cloner cloner)
49      : base(content, cloner) {
50      this.PreprocessingData = content.PreprocessingData;
51      this.variableItemList = cloner.Clone<ICheckedItemList<StringValue>>(variableItemList);
52    }
53    public override IDeepCloneable Clone(Cloner cloner) {
54      return new PreprocessingChartContent(this, cloner);
55    }
56
57    public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {
58      IList<double> values = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableName));
59      DataRow row = new DataRow(variableName, "", values);
60      row.VisualProperties.ChartType = chartType;
61      return row;
62    }
63
64
65
66
67    public ICheckedItemList<StringValue> CreateVariableItemList(IList<string> checkedItems = null) {
68      if (checkedItems == null) checkedItems = new string[0];
69      ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>();
70      foreach (string name in PreprocessingData.GetDoubleVariableNames()) {
71        var n = new StringValue(name);
72        itemList.Add(n, checkedItems.Contains(name));
73      }
74      return new ReadOnlyCheckedItemList<StringValue>(itemList);
75    }
76
77    public event DataPreprocessingChangedEventHandler Changed {
78      add { PreprocessingData.Changed += value; }
79      remove { PreprocessingData.Changed -= value; }
80    }
81
82  }
83}
Note: See TracBrowser for help on using the repository browser.