Changeset 8032 for branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
- Timestamp:
- 06/18/12 11:18:51 (12 years ago)
- Location:
- branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Views merged eligible /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Views merged eligible /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views merged eligible /branches/Benchmarking/sources/HeuristicLab.Problems.DataAnalysis.Views 6917-7005 /branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Views 4656-4721 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Views 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.DataAnalysis.Views 5815-6180 /branches/GP.Grammar.Editor/HeuristicLab.Problems.DataAnalysis.Views 6284-6795 /branches/NET40/sources/HeuristicLab.Problems.DataAnalysis.Views 5138-5162 /branches/ParallelEngine/HeuristicLab.Problems.DataAnalysis.Views 5175-5192 /branches/QAPAlgorithms/HeuristicLab.Problems.DataAnalysis.Views 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Problems.DataAnalysis.Views 6828 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.DataAnalysis.Views 5370-5682 /branches/Trunk/HeuristicLab.Problems.DataAnalysis.Views 6829-6865 /branches/VNS/HeuristicLab.Problems.DataAnalysis.Views 5594-5752 /branches/histogram/HeuristicLab.Problems.DataAnalysis.Views 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r7327 r8032 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 { … … 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 77 // test series … … 79 80 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 80 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]); 81 83 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 82 84 // series of remaining points … … 84 86 var estimatedValues = Content.EstimatedValues.ToArray(); 85 87 List<double> allEstimatedValues = allIndizes.Select(index => estimatedValues[index]).ToList(); 86 87 88 this.chart.Series.Add(ESTIMATEDVALUES_ALL_SERIES_NAME); 88 89 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].LegendText = ESTIMATEDVALUES_ALL_SERIES_NAME; 89 90 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].ChartType = SeriesChartType.FastLine; 90 91 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Points.DataBindXY(allIndizes, allEstimatedValues); 92 this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); 91 93 this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME].Tag = Content; 92 94 this.ToggleSeriesData(this.chart.Series[ESTIMATEDVALUES_ALL_SERIES_NAME]); … … 94 96 UpdateCursorInterval(); 95 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; 96 118 } 97 119 } … … 196 218 if (series.Points.Count > 0) { //checks if series is shown 197 219 if (this.chart.Series.Any(s => s != series && s.Points.Count > 0)) { 198 series.Points.Clear();220 ClearPointsQuick(series.Points); 199 221 } 200 222 } else if (Content != null) { … … 219 241 } 220 242 series.Points.DataBindXY(indizes, predictedValues); 221 chart.DataManipulator.InsertEmptyPoints(1, IntervalType.Number, series.Name);243 this.InsertEmptyPoints(series); 222 244 chart.Legends[series.Legend].ForeColor = Color.Black; 223 245 UpdateCursorInterval(); 224 246 chart.Refresh(); 225 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(); 226 256 } 227 257
Note: See TracChangeset
for help on using the changeset viewer.