Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14118


Ignore:
Timestamp:
07/19/16 17:21:38 (8 years ago)
Author:
pfleck
Message:

#2597:

  • Fixed issue with automatic movement of the cursor in some cases (missing position changed event).
  • Disable the whole GradientChartConfigurationDialog during chart recalculation after pressing apply.
Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.Designer.cs

    r14099 r14118  
    8989      this.chart.TabIndex = 0;
    9090      this.chart.SelectionRangeChanged += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CursorEventArgs>(this.chart_SelectionRangeChanged);
     91      this.chart.AnnotationPositionChanged += new System.EventHandler(this.chart_AnnotationPositionChanged);
    9192      this.chart.AnnotationPositionChanging += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.AnnotationPositionChangingEventArgs>(this.chart_AnnotationPositionChanging);
    9293      this.chart.DragDrop += new System.Windows.Forms.DragEventHandler(this.chart_DragDrop);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.cs

    r14099 r14118  
    267267      }
    268268
    269       ResizeAllSeriesData();
    270       OrderAndColorSeries();
    271     }
    272 
    273     public async Task RecalculateAsync(bool updateOnFinish = true, bool resetYAxis = true) {
    274       if (IsDisposed
    275         || 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 label
    282 
    283       // cancel previous recalculate call
    284       if (cancelCurrentRecalculateSource != null)
    285         cancelCurrentRecalculateSource.Cancel();
    286       cancelCurrentRecalculateSource = new CancellationTokenSource();
    287 
    288269      // Set cursor and x-axis
    289270      // Make sure to allow a small offset to be able to distinguish the vertical line annotation from the axis
     
    302283        chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture);
    303284
     285      ResizeAllSeriesData();
     286      OrderAndColorSeries();
     287    }
     288
     289    public async Task RecalculateAsync(bool updateOnFinish = true, bool resetYAxis = true) {
     290      if (IsDisposed
     291        || sharedFixedVariables == null || !solutions.Any() || string.IsNullOrEmpty(freeVariable)
     292        || trainingMin.IsAlmost(trainingMax) || trainingMin > trainingMax || drawingSteps == 0)
     293        return;
     294
     295      calculationPendingTimer.Start();
     296
     297      // cancel previous recalculate call
     298      if (cancelCurrentRecalculateSource != null)
     299        cancelCurrentRecalculateSource.Cancel();
     300      cancelCurrentRecalculateSource = new CancellationTokenSource();
     301      var cancellationToken = cancelCurrentRecalculateSource.Token;
     302
    304303      // Update series
    305       var cancellationToken = cancelCurrentRecalculateSource.Token;
    306304      try {
    307305        var limits = await UpdateAllSeriesDataAsync(cancellationToken);
    308         //cancellationToken.ThrowIfCancellationRequested();
    309306
    310307        yMin = limits.Lower;
     
    453450          if (yvalues[i] > max) max = yvalues[i];
    454451        }
     452        chart.Invalidate();
     453
     454        cancellationToken.ThrowIfCancellationRequested();
    455455
    456456        var confidenceBoundSolution = solution as IConfidenceRegressionSolution;
    457457        if (confidenceBoundSolution != null) {
    458458          var confidenceIntervalSeries = ciSeriesCache[solution];
    459 
    460           cancellationToken.ThrowIfCancellationRequested();
    461           var variances =
    462             confidenceBoundSolution.Model.GetEstimatedVariances(internalDataset,
    463               Enumerable.Range(0, internalDataset.Rows)).ToList();
     459          var variances = confidenceBoundSolution.Model.GetEstimatedVariances(internalDataset, Enumerable.Range(0, internalDataset.Rows)).ToList();
    464460          for (int i = 0; i < xvalues.Count; i++) {
    465461            var lower = yvalues[i] - 1.96 * Math.Sqrt(variances[i]);
     
    469465            if (upper > max) max = upper;
    470466          }
     467          chart.Invalidate();
    471468        }
    472469
     
    619616
    620617      e.NewLocationX = newLocation;
    621       var annotation = VerticalLineAnnotation;
    622       var x = annotation.X;
     618
     619      UpdateCursor();
     620    }
     621    private void chart_AnnotationPositionChanged(object sender, EventArgs e) {
     622      UpdateCursor();
     623    }
     624    void UpdateCursor() {
     625      var x = VerticalLineAnnotation.X;
    623626      sharedFixedVariables.SetVariableValue(x, FreeVariable, 0);
    624627
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChartConfigurationDialog.cs

    r14099 r14118  
    5151    private async void okButton_Click(object sender, System.EventArgs e) {
    5252      try {
     53        Enabled = false;
    5354        chart.SuspendRepaint();
    5455        if (xAutomaticCheckBox.Checked) {
     
    8283      }
    8384      finally {
     85        Enabled = true;
    8486        chart.ResumeRepaint(true);
    8587      }
Note: See TracChangeset for help on using the changeset viewer.