Ignore:
Timestamp:
07/21/16 16:25:33 (6 years ago)
Author:
pfleck
Message:

#2597 Fixed an issue with wrongly positioned title and density chart after initialization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.cs

    r14131 r14158  
    145145        };
    146146
     147        // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...)
     148        // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting.
     149        gradientChart.ChartPostPaint += OnGradientChartOnChartPostPaint;
     150
    147151        var panel = new Panel() {
    148152          Dock = DockStyle.Fill,
     
    167171
    168172      RecalculateAndRelayoutCharts();
     173    }
     174
     175    private void OnGradientChartOnChartPostPaint(object o, EventArgs e) {
     176      var gradient = (GradientChart)o;
     177      var density = densityCharts[gradient.FreeVariable];
     178
     179      density.Width = gradient.Width;
     180
     181      var gcPlotPosition = gradient.InnerPlotPosition;
     182      density.Left = (int)(gcPlotPosition.X / 100.0 * gradient.Width);
     183      density.Width = (int)(gcPlotPosition.Width / 100.0 * gradient.Width);
     184      gradient.UpdateTitlePosition();
     185
     186      // removed after succesful layouting due to performance reasons
     187      if (gcPlotPosition.Width != 0)
     188        gradient.ChartPostPaint -= OnGradientChartOnChartPostPaint;
    169189    }
    170190
Note: See TracChangeset for help on using the changeset viewer.