Changeset 14525 for branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs
- Timestamp:
- 12/22/16 16:36:59 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs
r14521 r14525 103 103 var groupVariable = (string)comboBoxGroup.SelectedItem; 104 104 105 bool groupingActive = useGradientCheckBox.Checked &&groupVariable != NoGroupItem;105 bool isGroupingActive = groupVariable != NoGroupItem; 106 106 double min = 0, max = 1; 107 if ( groupingActive) {107 if (isGroupingActive) { 108 108 var groupValues = Content.PreprocessingData.GetValues<double>(Content.PreprocessingData.GetColumnIndex(groupVariable)) 109 109 .Distinct().OrderBy(x => x).ToList(); 110 min = groupValues.First ();111 max = groupValues.Last ();110 min = groupValues.FirstOrDefault(x => !double.IsNaN(x)); 111 max = groupValues.LastOrDefault(x => !double.IsNaN(x)); 112 112 } 113 113 ScatterPlot scatterPlot = Content.CreateScatterPlot(xVariable, yVariable, groupVariable); … … 122 122 row.VisualProperties.PolynomialRegressionOrder = order; 123 123 row.VisualProperties.IsVisibleInLegend = !useGradientCheckBox.Checked; 124 if ( groupingActive)124 if (isGroupingActive && useGradientCheckBox.Checked) 125 125 row.VisualProperties.Color = GetColor(double.Parse(row.Name), min, max); 126 126 } … … 133 133 scatterPlotControl.Content = scatterPlot; 134 134 135 if ( groupingActive) {135 if (isGroupingActive) { 136 136 gradientMinimumLabel.Text = min.ToString("G5"); 137 137 gradientMaximumLabel.Text = max.ToString("G5"); … … 228 228 var groupValues = Content.PreprocessingData.GetValues<double>(Content.PreprocessingData.GetColumnIndex(groupVariable)) 229 229 .Distinct().OrderBy(x => x).ToList(); 230 double min = groupValues.First (), max = groupValues.Last();230 double min = groupValues.FirstOrDefault(x => !double.IsNaN(x)), max = groupValues.LastOrDefault(x => !double.IsNaN(x)); 231 231 foreach (var group in groupValues) { 232 232 ScatterPlotDataRow row; … … 249 249 private static Color GetColor(double value, double min, double max) { 250 250 if (double.IsNaN(value)) { 251 return Color. DarkGray;251 return Color.Black; 252 252 } 253 253 var colors = ColorGradient.Colors;
Note: See TracChangeset
for help on using the changeset viewer.