Changeset 14158


Ignore:
Timestamp:
07/21/16 16:25:33 (13 months ago)
Author:
pfleck
Message:

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

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4
Files:
3 edited

Legend:

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

    r14131 r14158  
    9898      this.chart.Titles.Add(title1);
    9999      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);
    100101      this.chart.AnnotationPositionChanged += new System.EventHandler(this.chart_AnnotationPositionChanged);
    101102      this.chart.AnnotationPositionChanging += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.AnnotationPositionChangingEventArgs>(this.chart_AnnotationPositionChanging);
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.cs

    r14157 r14158  
    207207    #endregion
    208208
     209    public event EventHandler ChartPostPaint;
     210
    209211    public GradientChart() {
    210212      InitializeComponent();
     
    685687      UpdateTitlePosition();
    686688    }
     689
     690    private void chart_PostPaint(object sender, ChartPaintEventArgs e) {
     691      if (ChartPostPaint != null)
     692        ChartPostPaint(this, EventArgs.Empty);
     693    }
    687694    #endregion
    688695  }
  • 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.