Changeset 8484 for trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessRegressionSolutionLineChartView.cs
- Timestamp:
- 08/14/12 13:25:17 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessRegressionSolutionLineChartView.cs
r8475 r8484 91 91 // series of remaining points 92 92 int[] allIndices = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndices).Except(Content.ProblemData.TestIndices).ToArray(); 93 var estimatedValues = Content.EstimatedValues.ToArray(); 94 List<double> allEstimatedValues = allIndices.Select(index => estimatedValues[index]).ToList(); 93 mean = Content.EstimatedValues.ToArray(); 94 s2 = Content.EstimatedVariance.ToArray(); 95 lower = mean.Zip(s2, (m, s) => m - 1.96 * Math.Sqrt(s)).ToArray(); 96 upper = mean.Zip(s2, (m, s) => m + 1.96 * Math.Sqrt(s)).ToArray(); 97 List<double> allLower = allIndices.Select(index => lower[index]).ToList(); 98 List<double> allUpper = allIndices.Select(index => upper[index]).ToList(); 95 99 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 96 100 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 97 101 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.Range; 98 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allEstimatedValues); 99 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 102 if (allIndices.Count() > 0) { 103 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndices, allLower, allUpper); 104 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 105 } 100 106 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content; 101 107 … … 127 133 if ((int)p2.XValue - (int)p1.XValue != 1) { 128 134 // insert an empty point between p1 and p2 so that the line will be invisible (transparent) 129 var p = new DataPoint((int)((p1.XValue + p2.XValue) / 2), 0.0) { IsEmpty = true }; 135 var p = new DataPoint((int)((p1.XValue + p2.XValue) / 2), new double[] { 0.0, 0.0 }) { IsEmpty = true }; 136 // insert 130 137 series.Points.Insert(i + 1, p); 131 138 } … … 236 243 } 237 244 } else if (Content != null) { 238 string targetVariableName = Content.ProblemData.TargetVariable;239 245 240 246 IEnumerable<int> indices = null; … … 268 274 break; 269 275 } 270 series.Points.DataBindXY(indices, lower, upper); 271 this.InsertEmptyPoints(series); 272 chart.Legends[series.Legend].ForeColor = Color.Black; 273 UpdateCursorInterval(); 274 chart.Refresh(); 276 if (indices.Count() > 0) { 277 series.Points.DataBindXY(indices, lower, upper); 278 this.InsertEmptyPoints(series); 279 chart.Legends[series.Legend].ForeColor = Color.Black; 280 UpdateCursorInterval(); 281 chart.Refresh(); 282 } 275 283 } 276 284 } … … 300 308 private void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e) { 301 309 if (chart.Series.Count != 4) return; 302 e.LegendItems[0].Cells[1].ForeColor = this.chart.Series[ TARGETVARIABLE_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black;303 e.LegendItems[1].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_T RAINING_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black;304 e.LegendItems[2].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_ TEST_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black;305 e.LegendItems[3].Cells[1].ForeColor = this.chart.Series[ ESTIMATEDVALUES_ALL_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black;310 e.LegendItems[0].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 311 e.LegendItems[1].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 312 e.LegendItems[2].Cells[1].ForeColor = this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 313 e.LegendItems[3].Cells[1].ForeColor = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Count == 0 ? Color.Gray : Color.Black; 306 314 } 307 315 }
Note: See TracChangeset
for help on using the changeset viewer.