Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 14511 was 14511, checked in by pfleck, 7 years ago

#2709

  • Added Check Inputs/All/None buttons instead of showing disabled buttons of the ItemCollectionView.
  • Removed the PreprocessingCheckedItemListView. A standard ListView is used instead.
  • Fixed slow updating when simultaneously (un-)checking multiple variables in the chart views. (currently only works by using the new buttons)
File size: 3.3 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 {
39        if (variableItemList == null)
40          variableItemList = CreateVariableItemList();
41        return this.variableItemList;
42      }
43      //set { this.variableItemList = value; }
44    }
45
46    public IFilteredPreprocessingData PreprocessingData { get; private set; }
47
48    public PreprocessingChartContent(IFilteredPreprocessingData preprocessingData) {
49      PreprocessingData = preprocessingData;
50    }
51
52    public PreprocessingChartContent(PreprocessingChartContent content, Cloner cloner)
53      : base(content, cloner) {
54      this.PreprocessingData = content.PreprocessingData;
55      this.variableItemList = cloner.Clone<ICheckedItemList<StringValue>>(variableItemList);
56    }
57    public override IDeepCloneable Clone(Cloner cloner) {
58      return new PreprocessingChartContent(this, cloner);
59    }
60
61    public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {
62      IList<double> values = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableName));
63      DataRow row = new DataRow(variableName, "", values);
64      row.VisualProperties.ChartType = chartType;
65      return row;
66    }
67
68
69
70
71    public ICheckedItemList<StringValue> CreateVariableItemList() {
72      ICheckedItemList<StringValue> itemList = new CheckedItemList<StringValue>();
73      foreach (string name in PreprocessingData.GetDoubleVariableNames()) {
74        var n = new StringValue(name);
75        bool isInputTarget = PreprocessingData.InputVariables.Contains(name) || PreprocessingData.TargetVariable == name;
76        itemList.Add(n, isInputTarget);
77      }
78      return new ReadOnlyCheckedItemList<StringValue>(itemList);
79    }
80
81    public event DataPreprocessingChangedEventHandler Changed {
82      add { PreprocessingData.Changed += value; }
83      remove { PreprocessingData.Changed -= value; }
84    }
85
86  }
87}
Note: See TracBrowser for help on using the repository browser.