- Timestamp:
- 05/07/14 10:44:11 (10 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingChartView.cs
r10771 r10803 30 30 using HeuristicLab.Core.Views; 31 31 using HeuristicLab.Data; 32 using HeuristicLab.DataPreprocessing.Implementations; 32 33 using HeuristicLab.MainForm; 33 34 … … 39 40 40 41 private IChartLogic logic; 41 private DataTable dataTable;42 private List< DataTable> dataTablePerVariable;42 private PreprocessingDataTable dataTable; 43 private List<PreprocessingDataTable> dataTablePerVariable; 43 44 private ICheckedItemList<StringValue> variableItemList; 44 45 private List<DataRow> dataRows; … … 67 68 DataRow row = GetDataRow(variableName); 68 69 dataTable.Rows.Add(row); 69 DataTable d = newDataTable(variableName);70 PreprocessingDataTable d = new PreprocessingDataTable(variableName); 70 71 d.Rows.Add(row); 71 72 dataTablePerVariable.Add(d); … … 109 110 110 111 // init data table 111 dataTable = new DataTable(chartTitle);112 dataTable = new PreprocessingDataTable(chartTitle); 112 113 dataTable.Rows.AddRange(dataRows); 114 113 115 114 116 // init data table per variable 115 dataTablePerVariable = new List< DataTable>();117 dataTablePerVariable = new List<PreprocessingDataTable>(); 116 118 foreach(var checkedItem in variableItemList.CheckedItems) { 117 119 string variableName = variableItemList[checkedItem.Index].Value; 118 DataTable d = newDataTable(variableName);120 PreprocessingDataTable d = new PreprocessingDataTable(variableName); 119 121 DataRow row = GetDataRow(variableName); 122 //DataRow rowSelect = logic.CreateDataRowRange(variableName, 200, 400, chartType); 123 //rowSelect.Name = variableName + "(Selected)"; 124 //rowSelect.VisualProperties.Color = Color.Green; 125 120 126 d.Rows.Add(row); 127 //d.SelectedRows.Add(rowSelect); 128 121 129 dataTablePerVariable.Add(d); 122 } 123 130 131 } 124 132 } 125 133 … … 179 187 DataRow row = logic.CreateDataRow(name, chartType); 180 188 dataTable.Rows.Add(row); 181 DataTable d = newDataTable(name);189 PreprocessingDataTable d = new PreprocessingDataTable(name); 182 190 d.Rows.Add(row); 183 191 dataTablePerVariable.Add(d); … … 264 272 tableLayoutPanel.RowCount = rows; 265 273 266 List< DataTable>.Enumerator enumerator = dataTablePerVariable.GetEnumerator();274 List<PreprocessingDataTable>.Enumerator enumerator = dataTablePerVariable.GetEnumerator(); 267 275 for (int x = 0; x < columns; x++) { 268 276 … … 284 292 PreprocessingDataTableView dataView = new PreprocessingDataTableView(); 285 293 enumerator.MoveNext(); 286 DataTable d = enumerator.Current;294 PreprocessingDataTable d = enumerator.Current; 287 295 if (d == null) { 288 296 // dummy panel for empty field -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingDataTableView.cs
r10771 r10803 29 29 using System.Windows.Forms; 30 30 using System.Windows.Forms.DataVisualization.Charting; 31 using HeuristicLab.DataPreprocessing.Implementations; 31 32 32 33 namespace HeuristicLab.Analysis.Views { 33 34 [View("Preprocessing DataTable View")] 34 [Content(typeof( DataTable), false)]35 [Content(typeof(PreprocessingDataTable), false)] 35 36 public partial class PreprocessingDataTableView : ItemView, IConfigureableView { 36 37 protected List<Series> invisibleSeries; 37 38 protected Dictionary<IObservableList<double>, DataRow> valuesRowsTable; 38 39 39 public new DataTable Content {40 get { return ( DataTable)base.Content; }40 public new PreprocessingDataTable Content { 41 get { return (PreprocessingDataTable)base.Content; } 41 42 set { base.Content = value; } 42 43 } … … 103 104 //chart.Titles[0].Text = Content.Name; 104 105 AddDataRows(Content.Rows); 106 AddSelectedDataRows(Content.SelectedRows); 105 107 ConfigureChartArea(chart.ChartAreas[0]); 106 108 RecalculateAxesScale(chart.ChartAreas[0]); … … 130 132 chart.Series.Add(series); 131 133 } 134 132 135 ConfigureChartArea(chart.ChartAreas[0]); 133 136 RecalculateAxesScale(chart.ChartAreas[0]); 134 137 UpdateYCursorInterval(); 138 } 139 140 protected virtual void AddSelectedDataRows(IEnumerable<DataRow> rows) { 141 foreach (var row in rows) { 142 if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Line) { 143 //RegisterDataRowEvents(row); 144 row.VisualProperties.IsVisibleInLegend = false; 145 var series = new Series(row.Name); 146 ConfigureSeries(series, row); 147 FillSeriesWithRowValues(series, row); 148 chart.Series.Add(series); 149 } 150 } 135 151 } 136 152 … … 156 172 else series.Color = Color.Empty; 157 173 series.IsVisibleInLegend = row.VisualProperties.IsVisibleInLegend; 158 174 159 175 switch (row.VisualProperties.ChartType) { 160 176 case DataRowVisualProperties.DataRowChartType.Line: … … 518 534 } 519 535 536 // get minimum ignores nan values 537 private double GetMinimum(IEnumerable<double> values) 538 { 539 double min = Double.MaxValue; 540 541 foreach (double value in values) { 542 if (!Double.IsNaN(value) && value < min) 543 min = value; 544 } 545 return min; 546 } 547 548 //get maximium ignores nan values 549 private double GetMaximum(IEnumerable<double> values) { 550 double max = Double.MinValue; 551 552 foreach (double value in values) { 553 if (!Double.IsNaN(value) && value > max) 554 max = value; 555 } 556 return max; 557 } 558 520 559 protected virtual void CalculateHistogram(Series series, DataRow row) { 521 560 series.Points.Clear(); … … 523 562 int bins = row.VisualProperties.Bins; 524 563 525 double minValue = row.Values.Min();526 double maxValue = row.Values.Max();564 double minValue = GetMinimum(row.Values); 565 double maxValue = GetMaximum(row.Values); 527 566 double intervalWidth = (maxValue - minValue) / bins; 528 567 if (intervalWidth < 0) return;
Note: See TracChangeset
for help on using the changeset viewer.