Changeset 7460 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression
- Timestamp:
- 02/06/12 17:50:17 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
- Property svn:ignore
-
old new 3 3 *.resharper 4 4 *.suo 5 *.user 5 6 *.vsp 6 7 Doxygen 8 FxCopResults.txt 7 9 Google.ProtocolBuffers-0.9.1.dll 8 10 HeuristicLab 3.3.5.1.ReSharper.user
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r7268 r7460 26 26 using System.Windows.Forms.DataVisualization.Charting; 27 27 using HeuristicLab.MainForm; 28 using HeuristicLab.MainForm.WindowsForms;29 28 30 29 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 68 67 this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray(), 69 68 Content.ProblemData.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToArray()); 70 69 // training series 71 70 this.chart.Series.Add(ESTIMATEDVALUES_TRAINING_SERIES_NAME); 72 71 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME; 73 72 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 73 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.Color = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Color; 74 74 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray()); 75 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]); 75 76 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content; 76 this.chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, ESTIMATEDVALUES_TRAINING_SERIES_NAME); 77 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.BorderWidth = 0; 78 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.MarkerStyle = MarkerStyle.None; 79 80 77 // test series 81 78 this.chart.Series.Add(ESTIMATEDVALUES_TEST_SERIES_NAME); 82 79 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 83 80 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 84 81 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray()); 82 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]); 85 83 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 86 87 84 // series of remaining points 88 85 int[] allIndizes = Enumerable.Range(0, Content.ProblemData.Dataset.Rows).Except(Content.ProblemData.TrainingIndizes).Except(Content.ProblemData.TestIndizes).ToArray(); 89 86 var estimatedValues = Content.EstimatedValues.ToArray(); 90 87 List<double> allEstimatedValues = allIndizes.Select(index => estimatedValues[index]).ToList(); 91 92 88 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 93 89 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 94 90 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine; 95 91 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndizes, allEstimatedValues); 92 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 96 93 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content; 97 this.chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, ESTIMATEDVALUES_ALL_SERIES_NAME);98 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.BorderWidth = 0;99 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].EmptyPointStyle.MarkerStyle = MarkerStyle.None;100 94 this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 101 95 102 96 UpdateCursorInterval(); 103 97 this.UpdateStripLines(); 98 } 99 } 100 101 private void InsertEmptyPoints(Series series) { 102 int i = 0; 103 while (i < series.Points.Count - 1) { 104 if (series.Points[i].IsEmpty) { 105 ++i; 106 continue; 107 } 108 109 var p1 = series.Points[i]; 110 var p2 = series.Points[i + 1]; 111 // check for consecutive indices 112 if ((int)p2.XValue - (int)p1.XValue != 1) { 113 // insert an empty point between p1 and p2 so that the line will be invisible (transparent) 114 var p = new DataPoint((int)((p1.XValue + p2.XValue) / 2), 0.0) { IsEmpty = true }; 115 series.Points.Insert(i + 1, p); 116 } 117 ++i; 104 118 } 105 119 } … … 204 218 if (series.Points.Count > 0) { //checks if series is shown 205 219 if (this.chart.Series.Any(s => s != series && s.Points.Count > 0)) { 206 series.Points.Clear();220 ClearPointsQuick(series.Points); 207 221 } 208 222 } else if (Content != null) { … … 227 241 } 228 242 series.Points.DataBindXY(indizes, predictedValues); 229 chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, series.Name);243 this.InsertEmptyPoints(series); 230 244 chart.Legends[series.Legend].ForeColor = Color.Black; 231 245 UpdateCursorInterval(); 232 246 chart.Refresh(); 233 247 } 248 } 249 250 // workaround as per http://stackoverflow.com/questions/5744930/datapointcollection-clear-performance 251 private static void ClearPointsQuick(DataPointCollection points) { 252 points.SuspendUpdates(); 253 while (points.Count > 0) 254 points.RemoveAt(points.Count - 1); 255 points.ResumeUpdates(); 234 256 } 235 257
Note: See TracChangeset
for help on using the changeset viewer.