Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14131


Ignore:
Timestamp:
07/20/16 15:56:56 (8 years ago)
Author:
pfleck
Message:

#2597:

  • Moved variable name + cursor value to the top.
  • Fixed some warnings (missing async await).
Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4
Files:
4 edited

Legend:

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

    r14118 r14131  
    3131      System.Windows.Forms.DataVisualization.Charting.StripLine stripLine2 = new System.Windows.Forms.DataVisualization.Charting.StripLine();
    3232      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();
    3334      this.calculationPendingLabel = new System.Windows.Forms.Label();
    3435      this.calculationPendingTimer = new System.Windows.Forms.Timer(this.components);
     
    7475      chartArea1.Name = "ChartArea";
    7576      chartArea1.Position.Auto = false;
    76       chartArea1.Position.Height = 100F;
     77      chartArea1.Position.Height = 90F;
    7778      chartArea1.Position.Width = 100F;
     79      chartArea1.Position.Y = 10F;
    7880      this.chart.ChartAreas.Add(chartArea1);
    7981      this.chart.Dock = System.Windows.Forms.DockStyle.Fill;
     
    8890      this.chart.Size = new System.Drawing.Size(453, 308);
    8991      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);
    9099      this.chart.SelectionRangeChanged += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CursorEventArgs>(this.chart_SelectionRangeChanged);
    91100      this.chart.AnnotationPositionChanged += new System.EventHandler(this.chart_AnnotationPositionChanged);
     
    94103      this.chart.DragEnter += new System.Windows.Forms.DragEventHandler(this.chart_DragEnter);
    95104      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
     105      this.chart.Resize += new System.EventHandler(this.chart_Resize);
    96106      //
    97107      // configurationButton
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.cs

    r14118 r14131  
    6666      set {
    6767        chart.Annotations[0].Visible = value;
    68         if (!value) chart.ChartAreas[0].AxisX.Title = string.Empty;
     68        if (!value) chart.Titles[0].Text = string.Empty;
    6969      }
    7070    }
     
    281281
    282282      if (ShowCursor)
    283         chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture);
     283        chart.Titles[0].Text = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture);
    284284
    285285      ResizeAllSeriesData();
     
    323323          throw;
    324324      }
     325    }
     326
     327    public void UpdateTitlePosition() {
     328      var title = chart.Titles[0];
     329      var plotArea = InnerPlotPosition;
     330
     331      title.Visible = plotArea.Width != 0;
     332
     333      title.Position.X = plotArea.X + (plotArea.Width / 2);
    325334    }
    326335
     
    627636
    628637      if (ShowCursor) {
    629         chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);
     638        chart.Titles[0].Text = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);
    630639        chart.Update();
    631640      }
     
    639648    }
    640649
    641     private void chart_DragDrop(object sender, DragEventArgs e) {
     650    private async void chart_DragDrop(object sender, DragEventArgs e) {
    642651      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    643652      if (data != null) {
    644653        var solution = data as IRegressionSolution;
    645654        if (!solutions.Contains(solution))
    646           AddSolutionAsync(solution);
     655          await AddSolutionAsync(solution);
    647656      }
    648657    }
     
    670679      OnZoomChanged(this, EventArgs.Empty);
    671680    }
     681
     682    private void chart_Resize(object sender, EventArgs e) {
     683      UpdateTitlePosition();
     684    }
    672685    #endregion
    673686  }
    674687}
     688
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.cs

    r14095 r14131  
    162162    }
    163163
    164     private void trackbar_CheckedChanged(object sender, EventArgs e) {
     164    private async void trackbar_CheckedChanged(object sender, EventArgs e) {
    165165      var trackBar = sender as DensityTrackbar;
    166166      if (trackBar == null || !trackBar.Checked) return;
     
    169169        tb.Checked = false;
    170170      gradientChart.FreeVariable = variableNames[trackbars.IndexOf(trackBar)];
    171       gradientChart.RecalculateAsync();
    172     }
    173 
    174     private void trackbar_LimitsChanged(object sender, EventArgs e) {
     171      await gradientChart.RecalculateAsync();
     172    }
     173
     174    private async void trackbar_LimitsChanged(object sender, EventArgs e) {
    175175      var trackBar = sender as DensityTrackbar;
    176176      if (trackBar == null || !trackBar.Checked) return;
    177177      gradientChart.FixedXAxisMin = trackBar.Limits.Lower;
    178178      gradientChart.FixedXAxisMax = trackBar.Limits.Upper;
    179       gradientChart.RecalculateAsync();
    180     }
    181 
    182     private void trackbar_ValueChanged(object sender, EventArgs e) {
     179      await gradientChart.RecalculateAsync();
     180    }
     181
     182    private async void trackbar_ValueChanged(object sender, EventArgs e) {
    183183      var trackBar = sender as DensityTrackbar;
    184184      if (trackBar == null) return;
    185185      sharedFixedVariables.SetVariableValue((double)trackBar.Value, variableNames[trackbars.IndexOf(trackBar)], 0);
    186       gradientChart.RecalculateAsync();
     186      await gradientChart.RecalculateAsync();
    187187    }
    188188
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.cs

    r14095 r14131  
    127127          Margin = Padding.Empty,
    128128          Height = 12,
    129           Visible = false
     129          Visible = false,
     130          Top = (int)(gradientChart.Height * 0.1),
    130131        };
    131132        densityCharts.Add(variableName, densityChart);
     
    137138          if (density.Visible)
    138139            UpdateDensityChart(density, gradient.FreeVariable);
     140        };
     141        gradientChart.SizeChanged += (o, e) => {
     142          var gradient = (GradientChart)o;
     143          var density = densityCharts[gradient.FreeVariable];
     144          density.Top = (int)(gradient.Height * 0.1);
    139145        };
    140146
     
    372378        densityChart.Visible = true;
    373379      }
     380
     381      gradientChart.UpdateTitlePosition();
    374382    }
    375383
Note: See TracChangeset for help on using the changeset viewer.