Changeset 14459 for branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
- Timestamp:
- 12/07/16 13:50:21 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/PreprocessingChartContent.cs
r14418 r14459 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using System.Drawing; … … 33 32 public static new Image StaticItemImage { 34 33 get { return HeuristicLab.Common.Resources.VSImageLibrary.PieChart; } 35 }36 37 private bool allInOneMode = true;38 public bool AllInOneMode {39 get { return this.allInOneMode; }40 set { this.allInOneMode = value; }41 34 } 42 35 … … 55 48 public PreprocessingChartContent(PreprocessingChartContent content, Cloner cloner) 56 49 : base(content, cloner) { 57 this.allInOneMode = content.allInOneMode;58 50 this.PreprocessingData = content.PreprocessingData; 59 51 this.variableItemList = cloner.Clone<ICheckedItemList<StringValue>>(variableItemList); … … 62 54 return new PreprocessingChartContent(this, cloner); 63 55 } 64 65 56 66 57 public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) { … … 71 62 } 72 63 73 public List<DataRow> CreateAllDataRows(DataRowVisualProperties.DataRowChartType chartType) {74 List<DataRow> dataRows = new List<DataRow>();75 foreach (var name in PreprocessingData.GetDoubleVariableNames())76 dataRows.Add(CreateDataRow(name, chartType));77 return dataRows;78 }79 64 80 public DataRow CreateSelectedDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {81 82 IDictionary<int, IList<int>> selection = PreprocessingData.Selection;83 int variableIndex = PreprocessingData.GetColumnIndex(variableName);84 85 if (selection.Keys.Contains(variableIndex)) {86 List<int> selectedIndices = new List<int>(selection[variableIndex]);87 //need selection with more than 1 value88 if (selectedIndices.Count < 2)89 return null;90 91 selectedIndices.Sort();92 int start = selectedIndices[0];93 int end = selectedIndices[selectedIndices.Count - 1];94 95 DataRow rowSelect = CreateDataRowRange(variableName, start, end, chartType);96 return rowSelect;97 } else98 return null;99 }100 101 public DataRow CreateDataRowRange(string variableName, int start, int end, DataRowVisualProperties.DataRowChartType chartType) {102 IList<double> values = PreprocessingData.GetValues<double>(PreprocessingData.GetColumnIndex(variableName));103 IList<double> valuesRange = new List<double>();104 for (int i = 0; i < values.Count; i++) {105 if (i >= start && i <= end)106 valuesRange.Add(values[i]);107 else108 valuesRange.Add(Double.NaN);109 }110 111 DataRow row = new DataRow(variableName, "", valuesRange);112 row.VisualProperties.ChartType = chartType;113 return row;114 }115 116 public List<DataRow> CreateAllSelectedDataRows(DataRowVisualProperties.DataRowChartType chartType) {117 List<DataRow> dataRows = new List<DataRow>();118 foreach (var name in PreprocessingData.GetDoubleVariableNames()) {119 DataRow row = CreateSelectedDataRow(name, chartType);120 if (row != null)121 dataRows.Add(row);122 }123 return dataRows;124 }125 65 126 66
Note: See TracChangeset
for help on using the changeset viewer.