Changeset 10803 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingDataTableView.cs
- Timestamp:
- 05/07/14 10:44:11 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.