Changeset 10979
- Timestamp:
- 06/11/14 13:18:37 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab 3.3.sln
r10978 r10979 1 1 2 2 Microsoft Visual Studio Solution File, Format Version 12.00 3 # Visual Studio 2012 3 # Visual Studio 2013 4 VisualStudioVersion = 12.0.30501.0 5 MinimumVisualStudioVersion = 10.0.40219.1 4 6 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{96396439-A764-4022-A8D2-BE021449B8D1}" 5 7 ProjectSection(SolutionItems) = preProject … … 1924 1926 HideSolutionNode = FALSE 1925 1927 EndGlobalSection 1926 GlobalSection(Performance) = preSolution1927 HasPerformanceSessions = true1928 EndGlobalSection1929 1928 EndGlobal -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataCompletenessView.Designer.cs
r10913 r10979 28 28 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 29 29 System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 30 System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();31 30 this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 32 31 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); … … 35 34 // chart 36 35 // 36 this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 37 | System.Windows.Forms.AnchorStyles.Left) 38 | System.Windows.Forms.AnchorStyles.Right))); 37 39 chartArea1.Name = "ChartArea1"; 38 40 this.chart.ChartAreas.Add(chartArea1); … … 41 43 this.chart.Location = new System.Drawing.Point(4, 4); 42 44 this.chart.Name = "chart"; 43 series1.ChartArea = "ChartArea1";44 series1.Legend = "Legend1";45 series1.Name = "Series1";46 this.chart.Series.Add(series1);47 45 this.chart.Size = new System.Drawing.Size(486, 337); 48 46 this.chart.TabIndex = 0; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataCompletenessView.cs
r10913 r10979 7 7 using HeuristicLab.DataPreprocessing.Implementations; 8 8 using System.Drawing; 9 using System.Windows.Forms.DataVisualization.Charting; 9 10 10 11 namespace HeuristicLab.DataPreprocessing.Views { … … 15 16 { 16 17 17 protected DataRowVisualProperties.DataRowChartType chartType;18 protected string chartTitle;19 20 private const string DEFAULT_CHART_TITLE = "DataCompletenessChart";21 22 18 //list of columns, bool indicates wether the cell is a missing value or not 23 19 private List<List<bool>> matrix = new List<List<bool>>(); 20 //series colors 21 private static Color colorNonMissingVal = Color.CornflowerBlue; 22 private static Color colorMissingVal = Color.Orange; 24 23 25 24 public new DataCompletenessChartContent Content … … 33 32 { 34 33 InitializeComponent(); 35 chartType = DataRowVisualProperties.DataRowChartType.Bars;36 chartTitle = DEFAULT_CHART_TITLE;37 34 } 38 35 … … 42 39 if (Content != null) 43 40 { 41 //chart.PrePaint += chart_PrePaint; 42 //chart.CustomizeLegend += chart_CustomizeLegend; 44 43 InitData(); 45 44 } 46 45 } 46 47 48 /* 49 void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e) 50 { 51 foreach (LegendItem li in e.LegendItems) 52 { 53 int label; 54 int.TryParse(li.Cells[0].ToString(), out label); 55 56 li.Cells[0].Text = "Banane"; 57 //li.Cells[0].Text = (label - Content.DataGridLogic.Rows).ToString(); 58 } 59 }*/ 47 60 48 61 private void InitData() … … 59 72 } 60 73 List<List<int>> yValuesPerColumn = ProcessMatrixForCharting(matrix, missingValueIndices); 61 createSeries(yValuesPerColumn);62 //CreateChart();74 PrepareChart(); 75 CreateSeries(yValuesPerColumn); 63 76 } 64 77 65 private void createSeries(List<List<int>> yValuesPerColumn) 78 private void PrepareChart() 79 { 80 chart.Titles.Add("DataCompletenessChart"); 81 chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0; 82 chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0; 83 chart.ChartAreas[0].AxisX.IsMarginVisible = false; 84 chart.ChartAreas[0].AxisY.IsMarginVisible = false; 85 //custom x axis label 86 double from = 0.5; 87 foreach (String columnName in Content.DataGridLogic.ColumnNames) 88 { 89 double to = from + 1; 90 chart.ChartAreas[0].AxisX.CustomLabels.Add(from, to, columnName); 91 from = to; 92 } 93 //custom y axis label 94 chart.ChartAreas[0].AxisY.IsReversed = true; 95 } 96 97 98 99 private void CreateSeries(List<List<int>> yValuesPerColumn) 66 100 { 67 101 //prepare series 68 int seriesCount = determineSeriesCount(yValuesPerColumn);102 int seriesCount = DetermineSeriesCount(yValuesPerColumn); 69 103 for (int i = 0; i < seriesCount; i++) 70 104 { 71 chart.Series.Add("series"+i); 72 chart.Series["series"+i].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn; 105 chart.Series.Add(CreateSeriesName(i)); 106 Series series = chart.Series[CreateSeriesName(i)]; 107 series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn; 108 series.IsVisibleInLegend = false; 109 series["PointWidth"] = "1.0"; 73 110 if (i % 2 == 0) 74 chart.Series["series" + i].Color = Color.Blue; 111 { 112 if (i == 0) //show legend for non missing values only once 113 series.IsVisibleInLegend = true; 114 series.Color = colorNonMissingVal; 115 } 75 116 else 76 chart.Series["series" + i].Color = Color.White; 117 { 118 if (i == 1) //show legend for missing values only once 119 series.IsVisibleInLegend = true; 120 series.Color = colorMissingVal; 121 } 77 122 } 78 123 //fill series … … 82 127 for (int j = 0; j < seriesCount; j++) { 83 128 if (column.Count - 1 < j) { 84 chart.Series[ "series"+j].Points.AddY(0);129 chart.Series[CreateSeriesName(j)].Points.AddY(0); 85 130 } else { 86 chart.Series[ "series" + j].Points.AddY(column[j]);131 chart.Series[CreateSeriesName(j)].Points.AddY(column[j]); 87 132 } 88 133 } … … 90 135 } 91 136 92 private int determineSeriesCount(List<List<int>> yValuesPerColumn) 137 private String CreateSeriesName(int index) 138 { 139 if (index == 0) 140 return "non-missing value"; 141 else if (index == 1) 142 return "missing value"; 143 return "series" + index; 144 } 145 146 #region data_preparation_for_chartseries 147 private int DetermineSeriesCount(List<List<int>> yValuesPerColumn) 93 148 { 94 149 int highest = 0; … … 121 176 } 122 177 yValues.Add(valueCount); 123 /*124 List<int> yValues = new List<int>();125 bool missingChanged = true;126 while ()127 * */178 if (missingState) //handle last missing 179 { 180 yValues.Add(0); 181 } 182 //yValues.Reverse(); 128 183 columnsYValues.Add(yValues); 129 184 } 130 185 return columnsYValues; 131 186 } 132 133 const String missingValue = "Red"; 134 const String existingValue = "DarkBlue"; 135 136 137 private void CreateChart() 138 { 139 object[] temp = new[] { "1", "50" }; 140 object[] temp2 = new[] { "50", "1000" }; 141 chart.Series.Add(missingValue); 142 chart.Series.Add(existingValue); 143 144 for(int i=0; i < matrix.Count; i++) { 145 List<bool> column = matrix[i]; 146 for (int j = 0; j < column.Count; j++ ) 147 { 148 chart.Series[missingValue].Points.AddXY(i, temp); 149 chart.Series[existingValue].Points.AddXY(i, temp2); 150 chart.Series[missingValue].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedBar; 151 chart.Series[existingValue].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedBar; 152 } 153 } 154 } 155 156 /* 157 private DataRow columnToDataRow(List<bool> column, int i) 158 { 159 DataRow row = new DataRow("row"+i); 160 foreach (bool missing in column) { 161 row.Values.Add(missing? 1 : 0); 162 } 163 return row; 164 }*/ 165 187 #endregion 166 188 } 167 189 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.Designer.cs
r10933 r10979 42 42 this.rBtnAnd = new System.Windows.Forms.RadioButton(); 43 43 this.groupBox1 = new System.Windows.Forms.GroupBox(); 44 this.label4 = new System.Windows.Forms.Label(); 44 45 this.label1 = new System.Windows.Forms.Label(); 45 46 this.label2 = new System.Windows.Forms.Label(); 46 47 this.label3 = new System.Windows.Forms.Label(); 47 this.label4 = new System.Windows.Forms.Label();48 48 this.groupBoxFilter.SuspendLayout(); 49 49 this.groupBoxFilterInfo.SuspendLayout(); … … 152 152 // 153 153 this.applyFilterButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 154 this.applyFilterButton.Cursor = System.Windows.Forms.Cursors.Default; 154 155 this.applyFilterButton.Enabled = false; 155 156 this.applyFilterButton.Location = new System.Drawing.Point(554, 628); … … 165 166 this.rBtnOr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 166 167 this.rBtnOr.AutoSize = true; 168 this.rBtnOr.Cursor = System.Windows.Forms.Cursors.Default; 167 169 this.rBtnOr.Enabled = false; 168 170 this.rBtnOr.Location = new System.Drawing.Point(60, 634); … … 178 180 this.rBtnAnd.AutoSize = true; 179 181 this.rBtnAnd.Checked = true; 182 this.rBtnAnd.Cursor = System.Windows.Forms.Cursors.Default; 180 183 this.rBtnAnd.Enabled = false; 181 184 this.rBtnAnd.Location = new System.Drawing.Point(10, 634); … … 203 206 this.groupBox1.Text = "Filter Info"; 204 207 // 208 // label4 209 // 210 this.label4.AutoSize = true; 211 this.label4.Location = new System.Drawing.Point(15, 98); 212 this.label4.Name = "label4"; 213 this.label4.Size = new System.Drawing.Size(455, 13); 214 this.label4.TabIndex = 12; 215 this.label4.Text = "The Apply Filter Button permanently activates the filters. This means unfiltered " + 216 "rows are deleted."; 217 // 205 218 // label1 206 219 // … … 231 244 this.label3.TabIndex = 6; 232 245 this.label3.Text = "A filter specifies the data rows which should remain."; 233 //234 // label4235 //236 this.label4.AutoSize = true;237 this.label4.Location = new System.Drawing.Point(15, 98);238 this.label4.Name = "label4";239 this.label4.Size = new System.Drawing.Size(455, 13);240 this.label4.TabIndex = 12;241 this.label4.Text = "The Apply Filter Button permanently activates the filters. This means unfiltered " +242 "rows are deleted.";243 246 // 244 247 // FilterView -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.cs
r10933 r10979 72 72 73 73 tbFiltered.Text = filteredCnt.ToString(); 74 double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / result.Length;75 tbPercentage.Text = percentage.ToString() + "%";74 double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / (double)result.Length; 75 tbPercentage.Text = String.Format("{0:0.0000}%", percentage); 76 76 tbTotal.Text = result.Length.ToString(); 77 77 }
Note: See TracChangeset
for help on using the changeset viewer.