- Timestamp:
- 07/21/16 17:24:22 (8 years ago)
- Location:
- stable
- Files:
-
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14095-14096,14098-14099,14118,14131,14157-14158
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.Designer.cs
r14099 r14166 31 31 System.Windows.Forms.DataVisualization.Charting.StripLine stripLine2 = new System.Windows.Forms.DataVisualization.Charting.StripLine(); 32 32 System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 33 System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title(); 33 34 this.calculationPendingLabel = new System.Windows.Forms.Label(); 34 35 this.calculationPendingTimer = new System.Windows.Forms.Timer(this.components); … … 74 75 chartArea1.Name = "ChartArea"; 75 76 chartArea1.Position.Auto = false; 76 chartArea1.Position.Height = 100F;77 chartArea1.Position.Height = 90F; 77 78 chartArea1.Position.Width = 100F; 79 chartArea1.Position.Y = 10F; 78 80 this.chart.ChartAreas.Add(chartArea1); 79 81 this.chart.Dock = System.Windows.Forms.DockStyle.Fill; … … 88 90 this.chart.Size = new System.Drawing.Size(453, 308); 89 91 this.chart.TabIndex = 0; 92 title1.Alignment = System.Drawing.ContentAlignment.TopCenter; 93 title1.DockedToChartArea = "ChartArea"; 94 title1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 95 title1.IsDockedInsideChartArea = false; 96 title1.Name = "Title"; 97 title1.Text = "[Title]"; 98 this.chart.Titles.Add(title1); 90 99 this.chart.SelectionRangeChanged += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CursorEventArgs>(this.chart_SelectionRangeChanged); 100 this.chart.PostPaint += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ChartPaintEventArgs>(this.chart_PostPaint); 101 this.chart.AnnotationPositionChanged += new System.EventHandler(this.chart_AnnotationPositionChanged); 91 102 this.chart.AnnotationPositionChanging += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.AnnotationPositionChangingEventArgs>(this.chart_AnnotationPositionChanging); 92 103 this.chart.DragDrop += new System.Windows.Forms.DragEventHandler(this.chart_DragDrop); 93 104 this.chart.DragEnter += new System.Windows.Forms.DragEventHandler(this.chart_DragEnter); 94 105 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 106 this.chart.Resize += new System.EventHandler(this.chart_Resize); 95 107 // 96 108 // configurationButton -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.cs
r14099 r14166 66 66 set { 67 67 chart.Annotations[0].Visible = value; 68 if (!value) chart. ChartAreas[0].AxisX.Title= string.Empty;68 if (!value) chart.Titles[0].Text = string.Empty; 69 69 } 70 70 } … … 207 207 #endregion 208 208 209 public event EventHandler ChartPostPaint; 210 209 211 public GradientChart() { 210 212 InitializeComponent(); … … 266 268 ciSeriesCache.Add(solution, series.Item2); 267 269 } 268 269 ResizeAllSeriesData();270 OrderAndColorSeries();271 }272 273 public async Task RecalculateAsync(bool updateOnFinish = true, bool resetYAxis = true) {274 if (IsDisposed275 || sharedFixedVariables == null || !solutions.Any() || string.IsNullOrEmpty(freeVariable)276 || trainingMin.IsAlmost(trainingMax) || trainingMin > trainingMax || drawingSteps == 0)277 return;278 279 calculationPendingTimer.Start();280 281 Update(); // immediately show label282 283 // cancel previous recalculate call284 if (cancelCurrentRecalculateSource != null)285 cancelCurrentRecalculateSource.Cancel();286 cancelCurrentRecalculateSource = new CancellationTokenSource();287 270 288 271 // Set cursor and x-axis … … 300 283 301 284 if (ShowCursor) 302 chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture); 285 chart.Titles[0].Text = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture); 286 287 ResizeAllSeriesData(); 288 OrderAndColorSeries(); 289 } 290 291 public async Task RecalculateAsync(bool updateOnFinish = true, bool resetYAxis = true) { 292 if (IsDisposed 293 || sharedFixedVariables == null || !solutions.Any() || string.IsNullOrEmpty(freeVariable) 294 || trainingMin.IsAlmost(trainingMax) || trainingMin > trainingMax || drawingSteps == 0) 295 return; 296 297 calculationPendingTimer.Start(); 298 299 // cancel previous recalculate call 300 if (cancelCurrentRecalculateSource != null) 301 cancelCurrentRecalculateSource.Cancel(); 302 cancelCurrentRecalculateSource = new CancellationTokenSource(); 303 var cancellationToken = cancelCurrentRecalculateSource.Token; 303 304 304 305 // Update series 305 var cancellationToken = cancelCurrentRecalculateSource.Token;306 306 try { 307 307 var limits = await UpdateAllSeriesDataAsync(cancellationToken); 308 //cancellationToken.ThrowIfCancellationRequested();309 308 310 309 yMin = limits.Lower; … … 328 327 } 329 328 329 public void UpdateTitlePosition() { 330 var title = chart.Titles[0]; 331 var plotArea = InnerPlotPosition; 332 333 title.Visible = plotArea.Width != 0; 334 335 title.Position.X = plotArea.X + (plotArea.Width / 2); 336 } 337 330 338 private void SetupAxis(Axis axis, double minValue, double maxValue, int ticks, double? fixedAxisMin, double? fixedAxisMax) { 331 double axisMin, axisMax, axisInterval; 332 ChartUtil.CalculateAxisInterval(minValue, maxValue, ticks, out axisMin, out axisMax, out axisInterval); 333 axis.Minimum = fixedAxisMin ?? axisMin; 334 axis.Maximum = fixedAxisMax ?? axisMax; 335 axis.Interval = (axis.Maximum - axis.Minimum) / ticks; 339 if (minValue < maxValue) { 340 double axisMin, axisMax, axisInterval; 341 ChartUtil.CalculateAxisInterval(minValue, maxValue, ticks, out axisMin, out axisMax, out axisInterval); 342 axis.Minimum = fixedAxisMin ?? axisMin; 343 axis.Maximum = fixedAxisMax ?? axisMax; 344 axis.Interval = (axis.Maximum - axis.Minimum) / ticks; 345 } 336 346 337 347 try { … … 453 463 if (yvalues[i] > max) max = yvalues[i]; 454 464 } 465 chart.Invalidate(); 466 467 cancellationToken.ThrowIfCancellationRequested(); 455 468 456 469 var confidenceBoundSolution = solution as IConfidenceRegressionSolution; 457 470 if (confidenceBoundSolution != null) { 458 471 var confidenceIntervalSeries = ciSeriesCache[solution]; 459 460 cancellationToken.ThrowIfCancellationRequested(); 461 var variances = 462 confidenceBoundSolution.Model.GetEstimatedVariances(internalDataset, 463 Enumerable.Range(0, internalDataset.Rows)).ToList(); 472 var variances = confidenceBoundSolution.Model.GetEstimatedVariances(internalDataset, Enumerable.Range(0, internalDataset.Rows)).ToList(); 464 473 for (int i = 0; i < xvalues.Count; i++) { 465 474 var lower = yvalues[i] - 1.96 * Math.Sqrt(variances[i]); … … 469 478 if (upper > max) max = upper; 470 479 } 480 chart.Invalidate(); 471 481 } 472 482 … … 619 629 620 630 e.NewLocationX = newLocation; 621 var annotation = VerticalLineAnnotation; 622 var x = annotation.X; 631 632 UpdateCursor(); 633 } 634 private void chart_AnnotationPositionChanged(object sender, EventArgs e) { 635 UpdateCursor(); 636 } 637 void UpdateCursor() { 638 var x = VerticalLineAnnotation.X; 623 639 sharedFixedVariables.SetVariableValue(x, FreeVariable, 0); 624 640 625 641 if (ShowCursor) { 626 chart. ChartAreas[0].AxisX.Title= FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);642 chart.Titles[0].Text = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture); 627 643 chart.Update(); 628 644 } … … 636 652 } 637 653 638 private void chart_DragDrop(object sender, DragEventArgs e) {654 private async void chart_DragDrop(object sender, DragEventArgs e) { 639 655 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 640 656 if (data != null) { 641 657 var solution = data as IRegressionSolution; 642 658 if (!solutions.Contains(solution)) 643 AddSolutionAsync(solution);659 await AddSolutionAsync(solution); 644 660 } 645 661 } … … 667 683 OnZoomChanged(this, EventArgs.Empty); 668 684 } 685 686 private void chart_Resize(object sender, EventArgs e) { 687 UpdateTitlePosition(); 688 } 689 690 private void chart_PostPaint(object sender, ChartPaintEventArgs e) { 691 if (ChartPostPaint != null) 692 ChartPostPaint(this, EventArgs.Empty); 693 } 669 694 #endregion 670 695 } 671 696 } 697 -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChartConfigurationDialog.cs
r14099 r14166 51 51 private async void okButton_Click(object sender, System.EventArgs e) { 52 52 try { 53 Enabled = false; 53 54 chart.SuspendRepaint(); 54 55 if (xAutomaticCheckBox.Checked) { … … 82 83 } 83 84 finally { 85 Enabled = true; 84 86 chart.ResumeRepaint(true); 85 87 }
Note: See TracChangeset
for help on using the changeset viewer.