Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/21/16 17:24:22 (8 years ago)
Author:
mkommend
Message:

#2597: Merged r14095, r14096, r14098, r14099, r14118, r14119, r14131, r14157, r14158 into stable.

Location:
stable
Files:
2 deleted
7 edited
9 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.Designer.cs

    r14099 r14166  
    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);
     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);
    91102      this.chart.AnnotationPositionChanging += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.AnnotationPositionChangingEventArgs>(this.chart_AnnotationPositionChanging);
    92103      this.chart.DragDrop += new System.Windows.Forms.DragEventHandler(this.chart_DragDrop);
    93104      this.chart.DragEnter += new System.Windows.Forms.DragEventHandler(this.chart_DragEnter);
    94105      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
     106      this.chart.Resize += new System.EventHandler(this.chart_Resize);
    95107      //
    96108      // configurationButton
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.cs

    r14099 r14166  
    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    }
     
    207207    #endregion
    208208
     209    public event EventHandler ChartPostPaint;
     210
    209211    public GradientChart() {
    210212      InitializeComponent();
     
    266268          ciSeriesCache.Add(solution, series.Item2);
    267269      }
    268 
    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();
    287270
    288271      // Set cursor and x-axis
     
    300283
    301284      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;
    303304
    304305      // Update series
    305       var cancellationToken = cancelCurrentRecalculateSource.Token;
    306306      try {
    307307        var limits = await UpdateAllSeriesDataAsync(cancellationToken);
    308         //cancellationToken.ThrowIfCancellationRequested();
    309308
    310309        yMin = limits.Lower;
     
    328327    }
    329328
     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
    330338    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      }
    336346
    337347      try {
     
    453463          if (yvalues[i] > max) max = yvalues[i];
    454464        }
     465        chart.Invalidate();
     466
     467        cancellationToken.ThrowIfCancellationRequested();
    455468
    456469        var confidenceBoundSolution = solution as IConfidenceRegressionSolution;
    457470        if (confidenceBoundSolution != null) {
    458471          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();
    464473          for (int i = 0; i < xvalues.Count; i++) {
    465474            var lower = yvalues[i] - 1.96 * Math.Sqrt(variances[i]);
     
    469478            if (upper > max) max = upper;
    470479          }
     480          chart.Invalidate();
    471481        }
    472482
     
    619629
    620630      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;
    623639      sharedFixedVariables.SetVariableValue(x, FreeVariable, 0);
    624640
    625641      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);
    627643        chart.Update();
    628644      }
     
    636652    }
    637653
    638     private void chart_DragDrop(object sender, DragEventArgs e) {
     654    private async void chart_DragDrop(object sender, DragEventArgs e) {
    639655      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    640656      if (data != null) {
    641657        var solution = data as IRegressionSolution;
    642658        if (!solutions.Contains(solution))
    643           AddSolutionAsync(solution);
     659          await AddSolutionAsync(solution);
    644660      }
    645661    }
     
    667683      OnZoomChanged(this, EventArgs.Empty);
    668684    }
     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    }
    669694    #endregion
    670695  }
    671696}
     697
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChartConfigurationDialog.cs

    r14099 r14166  
    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      }
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r14005 r14166  
    120120  </ItemGroup>
    121121  <ItemGroup>
     122    <Compile Include="Controls\DensityChart.cs">
     123      <SubType>UserControl</SubType>
     124    </Compile>
     125    <Compile Include="Controls\DensityChart.Designer.cs">
     126      <DependentUpon>DensityChart.cs</DependentUpon>
     127    </Compile>
     128    <Compile Include="Controls\DensityTrackbar.cs">
     129      <SubType>UserControl</SubType>
     130    </Compile>
     131    <Compile Include="Controls\DensityTrackbar.Designer.cs">
     132      <DependentUpon>DensityTrackbar.cs</DependentUpon>
     133    </Compile>
    122134    <Compile Include="FeatureCorrelation\TimeframeFeatureCorrelationCalculator.cs" />
    123135    <Compile Include="FeatureCorrelation\AbstractFeatureCorrelationCalculator.cs" />
     
    183195      <DependentUpon>FeatureCorrelationView.cs</DependentUpon>
    184196    </Compile>
     197    <Compile Include="Controls\GradientChart.cs">
     198      <SubType>UserControl</SubType>
     199    </Compile>
     200    <Compile Include="Controls\GradientChart.Designer.cs">
     201      <DependentUpon>GradientChart.cs</DependentUpon>
     202    </Compile>
     203    <Compile Include="Controls\GradientChartConfigurationDialog.cs">
     204      <SubType>Form</SubType>
     205    </Compile>
     206    <Compile Include="Controls\GradientChartConfigurationDialog.Designer.cs">
     207      <DependentUpon>GradientChartConfigurationDialog.cs</DependentUpon>
     208    </Compile>
    185209    <Compile Include="Interfaces\IDataPreprocessorStarter.cs" />
    186210    <Compile Include="MenuItems\ShrinkDataAnalysisRunsMenuItem.cs" />
     
    198222      <DependentUpon>ProblemDataView.cs</DependentUpon>
    199223    </Compile>
     224    <Compile Include="Regression\ConfidenceRegressionSolutionEstimatedValuesView.cs">
     225      <SubType>UserControl</SubType>
     226    </Compile>
     227    <Compile Include="Regression\ConfidenceRegressionSolutionEstimatedValuesView.Designer.cs">
     228      <DependentUpon>ConfidenceRegressionSolutionEstimatedValuesView.cs</DependentUpon>
     229    </Compile>
     230    <Compile Include="Regression\ConfidenceRegressionSolutionLineChartView.cs">
     231      <SubType>UserControl</SubType>
     232    </Compile>
     233    <Compile Include="Regression\ConfidenceRegressionSolutionLineChartView.Designer.cs">
     234      <DependentUpon>ConfidenceRegressionSolutionLineChartView.cs</DependentUpon>
     235    </Compile>
    200236    <Compile Include="Regression\RegressionEnsembleSolutionModelWeightsView.cs">
    201237      <SubType>UserControl</SubType>
     
    210246      <DependentUpon>RegressionFeatureCorrelationView.cs</DependentUpon>
    211247    </Compile>
     248    <Compile Include="Regression\RegressionSolutionGradientView.cs">
     249      <SubType>UserControl</SubType>
     250    </Compile>
     251    <Compile Include="Regression\RegressionSolutionGradientView.Designer.cs">
     252      <DependentUpon>RegressionSolutionGradientView.cs</DependentUpon>
     253    </Compile>
     254    <Compile Include="Regression\RegressionSolutionTargetResponseGradientView.cs">
     255      <SubType>UserControl</SubType>
     256    </Compile>
     257    <Compile Include="Regression\RegressionSolutionTargetResponseGradientView.Designer.cs">
     258      <DependentUpon>RegressionSolutionTargetResponseGradientView.cs</DependentUpon>
     259    </Compile>
    212260    <Compile Include="Regression\RegressionTimeframeFeatureCorrelationView.cs">
    213261      <SubType>UserControl</SubType>
     
    318366      <DependentUpon>DataAnalysisSolutionView.cs</DependentUpon>
    319367    </Compile>
    320     <Compile Include="DoubleLimitView.cs">
    321       <SubType>UserControl</SubType>
    322     </Compile>
    323     <Compile Include="DoubleLimitView.Designer.cs">
     368    <Compile Include="Controls\DoubleLimitView.cs">
     369      <SubType>UserControl</SubType>
     370    </Compile>
     371    <Compile Include="Controls\DoubleLimitView.Designer.cs">
    324372      <DependentUpon>DoubleLimitView.cs</DependentUpon>
    325373    </Compile>
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.cs

    r14096 r14166  
    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
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.cs

    r14096 r14166  
    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);
     
    138139            UpdateDensityChart(density, gradient.FreeVariable);
    139140        };
     141        gradientChart.SizeChanged += (o, e) => {
     142          var gradient = (GradientChart)o;
     143          var density = densityCharts[gradient.FreeVariable];
     144          density.Top = (int)(gradient.Height * 0.1);
     145        };
     146
     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;
    140150
    141151        var panel = new Panel() {
     
    161171
    162172      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;
    163189    }
    164190
     
    372398        densityChart.Visible = true;
    373399      }
     400
     401      gradientChart.UpdateTitlePosition();
    374402    }
    375403
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs

    r14022 r14166  
    3131
    3232namespace HeuristicLab.Problems.DataAnalysis.Views {
    33   [View("RegressionSolution View")]
     33  [View("Solution View")]
    3434  [Content(typeof(RegressionSolutionBase), false)]
    3535  public partial class RegressionSolutionView : DataAnalysisSolutionView {
Note: See TracChangeset for help on using the changeset viewer.