Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/11/17 18:43:17 (8 years ago)
Author:
gkronber
Message:

#2670 renamed TargetResponseCurve and GradientChart -> PartialDependencePlot

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression
Files:
2 edited
2 moved

Legend:

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

    r14095 r14852  
    4646    private void InitializeComponent() {
    4747      this.splitContainer = new System.Windows.Forms.SplitContainer();
    48       this.gradientChart = new HeuristicLab.Problems.DataAnalysis.Views.GradientChart();
     48      this._partialDependencePlot = new HeuristicLab.Problems.DataAnalysis.Views.PartialDependencePlot();
    4949      this.configurationGroupBox = new System.Windows.Forms.GroupBox();
    5050      this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
     
    6565      // splitContainer.Panel1
    6666      //
    67       this.splitContainer.Panel1.Controls.Add(this.gradientChart);
     67      this.splitContainer.Panel1.Controls.Add(this._partialDependencePlot);
    6868      //
    6969      // splitContainer.Panel2
     
    7474      this.splitContainer.TabIndex = 1;
    7575      //
    76       // gradientChart
     76      // _partialDependencePlot
    7777      //
    78       this.gradientChart.Dock = System.Windows.Forms.DockStyle.Fill;
    79       this.gradientChart.DrawingSteps = 1000;
    80       this.gradientChart.Location = new System.Drawing.Point(0, 0);
    81       this.gradientChart.Name = "gradientChart";
    82       this.gradientChart.ShowCursor = false;
    83       this.gradientChart.ShowLegend = false;
    84       this.gradientChart.Size = new System.Drawing.Size(715, 376);
    85       this.gradientChart.TabIndex = 0;
    86       this.gradientChart.XAxisTicks = 10;
    87       this.gradientChart.YAxisTicks = 5;
     78      this._partialDependencePlot.Dock = System.Windows.Forms.DockStyle.Fill;
     79      this._partialDependencePlot.DrawingSteps = 1000;
     80      this._partialDependencePlot.Location = new System.Drawing.Point(0, 0);
     81      this._partialDependencePlot.Name = "_partialDependencePlot";
     82      this._partialDependencePlot.ShowCursor = false;
     83      this._partialDependencePlot.ShowLegend = false;
     84      this._partialDependencePlot.Size = new System.Drawing.Size(715, 376);
     85      this._partialDependencePlot.TabIndex = 0;
     86      this._partialDependencePlot.XAxisTicks = 10;
     87      this._partialDependencePlot.YAxisTicks = 5;
    8888      //
    8989      // configurationGroupBox
     
    131131    private System.Windows.Forms.GroupBox configurationGroupBox;
    132132    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
    133     private Problems.DataAnalysis.Views.GradientChart gradientChart;
     133    private Problems.DataAnalysis.Views.PartialDependencePlot _partialDependencePlot;
    134134  }
    135135}
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.cs

    r14131 r14852  
    9494
    9595      sharedFixedVariables = new ModifiableDataset(variableNames, newTrackbars.Select(tb => new List<double>(1) { (double)tb.Value }));
    96       gradientChart.Configure(new[] { Content }, sharedFixedVariables, variableNames.First(), DrawingSteps);
    97       await gradientChart.RecalculateAsync();
     96      _partialDependencePlot.Configure(new[] { Content }, sharedFixedVariables, variableNames.First(), DrawingSteps);
     97      await _partialDependencePlot.RecalculateAsync();
    9898
    9999      // Add to table and observable lists
     
    122122      double axisMin, axisMax, axisInterval;
    123123      ChartUtil.CalculateAxisInterval(min - scale * range, max + scale * range, 5, out axisMin, out axisMax, out axisInterval);
    124       gradientChart.FixedYAxisMin = axisMin;
    125       gradientChart.FixedYAxisMax = axisMax;
     124      _partialDependencePlot.FixedYAxisMin = axisMin;
     125      _partialDependencePlot.FixedYAxisMax = axisMax;
    126126
    127127      trackbars.First().Checked = true;
     
    168168      foreach (var tb in trackbars.Except(new[] { trackBar }))
    169169        tb.Checked = false;
    170       gradientChart.FreeVariable = variableNames[trackbars.IndexOf(trackBar)];
    171       await gradientChart.RecalculateAsync();
     170      _partialDependencePlot.FreeVariable = variableNames[trackbars.IndexOf(trackBar)];
     171      await _partialDependencePlot.RecalculateAsync();
    172172    }
    173173
     
    175175      var trackBar = sender as DensityTrackbar;
    176176      if (trackBar == null || !trackBar.Checked) return;
    177       gradientChart.FixedXAxisMin = trackBar.Limits.Lower;
    178       gradientChart.FixedXAxisMax = trackBar.Limits.Upper;
    179       await gradientChart.RecalculateAsync();
     177      _partialDependencePlot.FixedXAxisMin = trackBar.Limits.Lower;
     178      _partialDependencePlot.FixedXAxisMax = trackBar.Limits.Upper;
     179      await _partialDependencePlot.RecalculateAsync();
    180180    }
    181181
     
    184184      if (trackBar == null) return;
    185185      sharedFixedVariables.SetVariableValue((double)trackBar.Value, variableNames[trackbars.IndexOf(trackBar)], 0);
    186       await gradientChart.RecalculateAsync();
     186      await _partialDependencePlot.RecalculateAsync();
    187187    }
    188188
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.Designer.cs

    r14851 r14852  
    11namespace HeuristicLab.Problems.DataAnalysis.Views {
    2   partial class RegressionSolutionTargetResponseGradientView {
     2  partial class RegressionSolutionPartialDependencePlotView {
    33    /// <summary>
    44    /// Required designer variable.
     
    2626      this.components = new System.ComponentModel.Container();
    2727      this.variableListView = new System.Windows.Forms.ListView();
    28       this.gradientChartTableLayout = new System.Windows.Forms.TableLayoutPanel();
     28      this.partialDependencePlotTableLayout = new System.Windows.Forms.TableLayoutPanel();
    2929      this.yAxisConfigGroupBox = new System.Windows.Forms.GroupBox();
    3030      this.limitView = new HeuristicLab.Problems.DataAnalysis.Views.DoubleLimitView();
     
    6363      this.variableListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.variableListView_ItemChecked);
    6464      //
    65       // gradientChartTableLayout
    66       //
    67       this.gradientChartTableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    68             | System.Windows.Forms.AnchorStyles.Right)));
    69       this.gradientChartTableLayout.AutoSize = true;
    70       this.gradientChartTableLayout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
    71       this.gradientChartTableLayout.ColumnCount = 1;
    72       this.gradientChartTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
    73       this.gradientChartTableLayout.Location = new System.Drawing.Point(0, 0);
    74       this.gradientChartTableLayout.Name = "gradientChartTableLayout";
    75       this.gradientChartTableLayout.RowCount = 1;
    76       this.gradientChartTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
    77       this.gradientChartTableLayout.Size = new System.Drawing.Size(542, 0);
    78       this.gradientChartTableLayout.TabIndex = 2;
     65      // partialDependencePlotTableLayout
     66      //
     67      this.partialDependencePlotTableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     68            | System.Windows.Forms.AnchorStyles.Right)));
     69      this.partialDependencePlotTableLayout.AutoSize = true;
     70      this.partialDependencePlotTableLayout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     71      this.partialDependencePlotTableLayout.ColumnCount = 1;
     72      this.partialDependencePlotTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     73      this.partialDependencePlotTableLayout.Location = new System.Drawing.Point(0, 0);
     74      this.partialDependencePlotTableLayout.Name = "partialDependencePlotTableLayout";
     75      this.partialDependencePlotTableLayout.RowCount = 1;
     76      this.partialDependencePlotTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
     77      this.partialDependencePlotTableLayout.Size = new System.Drawing.Size(542, 0);
     78      this.partialDependencePlotTableLayout.TabIndex = 2;
    7979      //
    8080      // yAxisConfigGroupBox
     
    196196      // scrollPanel
    197197      //
    198       this.scrollPanel.Controls.Add(this.gradientChartTableLayout);
     198      this.scrollPanel.Controls.Add(this.partialDependencePlotTableLayout);
    199199      this.scrollPanel.Dock = System.Windows.Forms.DockStyle.Fill;
    200200      this.scrollPanel.Location = new System.Drawing.Point(0, 0);
     
    228228      this.columnsNumericUpDown.ValueChanged += new System.EventHandler(this.columnsNumericUpDown_ValueChanged);
    229229      //
    230       // RegressionSolutionTargetResponseGradientView
     230      // RegressionSolutionPartialDependencePlotView
    231231      //
    232232      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    233233      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    234234      this.Controls.Add(this.configSplitContainer);
    235       this.Name = "RegressionSolutionTargetResponseGradientView";
     235      this.Name = "RegressionSolutionPartialDependencePlotView";
    236236      this.Size = new System.Drawing.Size(715, 648);
    237237      this.yAxisConfigGroupBox.ResumeLayout(false);
     
    255255
    256256    private System.Windows.Forms.ListView variableListView;
    257     private System.Windows.Forms.TableLayoutPanel gradientChartTableLayout;
     257    private System.Windows.Forms.TableLayoutPanel partialDependencePlotTableLayout;
    258258    private System.Windows.Forms.GroupBox yAxisConfigGroupBox;
    259259    private System.Windows.Forms.CheckBox automaticYAxisCheckBox;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs

    r14851 r14852  
    3333
    3434namespace HeuristicLab.Problems.DataAnalysis.Views {
    35   [View("Target Response Gradients")]
     35  [View("Partial Dependence Plots")]
    3636  [Content(typeof(IRegressionSolution))]
    37   public partial class RegressionSolutionTargetResponseGradientView : DataAnalysisSolutionEvaluationView {
    38     private readonly Dictionary<string, IGradientChart> gradientCharts;
     37  public partial class RegressionSolutionPartialDependencePlotView : DataAnalysisSolutionEvaluationView {
     38    private readonly Dictionary<string, IPartialDependencePlot> partialDependencePlots;
    3939    private readonly Dictionary<string, DensityChart> densityCharts;
    4040    private readonly Dictionary<string, Panel> groupingPanels;
     
    5050      }
    5151    }
    52     private IEnumerable<IGradientChart> VisibleGradientCharts {
    53       get { return VisibleVariables.Select(v => gradientCharts[v]); }
     52    private IEnumerable<IPartialDependencePlot> VisiblePartialDependencePlots {
     53      get { return VisibleVariables.Select(v => partialDependencePlots[v]); }
    5454    }
    5555    private IEnumerable<DensityChart> VisibleDensityCharts {
     
    6060    }
    6161
    62     public RegressionSolutionTargetResponseGradientView() {
     62    public RegressionSolutionPartialDependencePlotView() {
    6363      InitializeComponent();
    64       gradientCharts = new Dictionary<string, IGradientChart>();
     64      partialDependencePlots = new Dictionary<string, IPartialDependencePlot>();
    6565      densityCharts = new Dictionary<string, DensityChart>();
    6666      groupingPanels = new Dictionary<string, Panel>();
     
    137137
    138138      // create controls
    139       gradientCharts.Clear();
     139      partialDependencePlots.Clear();
    140140      densityCharts.Clear();
    141141      groupingPanels.Clear();
    142142      foreach (var variableName in doubleVariables) {
    143         var gradientChart = CreateGradientChart(variableName, sharedFixedVariables);
    144         gradientCharts.Add(variableName, gradientChart);
     143        var plot = CreatePartialDependencePlot(variableName, sharedFixedVariables);
     144        partialDependencePlots.Add(variableName, plot);
    145145
    146146        var densityChart = new DensityChart() {
     
    149149          Height = 12,
    150150          Visible = false,
    151           Top = (int)(gradientChart.Height * 0.1),
     151          Top = (int)(plot.Height * 0.1),
    152152        };
    153153        densityCharts.Add(variableName, densityChart);
    154154
    155         gradientChart.ZoomChanged += (o, e) => {
    156           var gradient = (GradientChart)o;
    157           var density = densityCharts[gradient.FreeVariable];
    158           density.Visible = densityComboBox.SelectedIndex != 0 && !gradient.IsZoomed;
     155        plot.ZoomChanged += (o, e) => {
     156          var pdp = (PartialDependencePlot)o;
     157          var density = densityCharts[pdp.FreeVariable];
     158          density.Visible = densityComboBox.SelectedIndex != 0 && !pdp.IsZoomed;
    159159          if (density.Visible)
    160             UpdateDensityChart(density, gradient.FreeVariable);
    161         };
    162         gradientChart.SizeChanged += (o, e) => {
    163           var gradient = (GradientChart)o;
    164           var density = densityCharts[gradient.FreeVariable];
    165           density.Top = (int)(gradient.Height * 0.1);
     160            UpdateDensityChart(density, pdp.FreeVariable);
     161        };
     162        plot.SizeChanged += (o, e) => {
     163          var pdp = (PartialDependencePlot)o;
     164          var density = densityCharts[pdp.FreeVariable];
     165          density.Top = (int)(pdp.Height * 0.1);
    166166        };
    167167
    168168        // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...)
    169169        // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting.
    170         gradientChart.ChartPostPaint += OnGradientChartPostPaint;
     170        plot.ChartPostPaint += OnPartialDependencePlotPostPaint;
    171171
    172172        var panel = new Panel() {
     
    177177
    178178        panel.Controls.Add(densityChart);
    179         panel.Controls.Add(gradientChart);
     179        panel.Controls.Add(plot);
    180180        groupingPanels.Add(variableName, panel);
    181181      }
    182182      foreach (var variableName in factorVariables) {
    183         var gradientChart = CreateFactorGradientChart(variableName, sharedFixedVariables);
    184         gradientCharts.Add(variableName, gradientChart);
     183        var plot = CreateFactorPartialDependencePlot(variableName, sharedFixedVariables);
     184        partialDependencePlots.Add(variableName, plot);
    185185
    186186        var densityChart = new DensityChart() {
     
    189189          Height = 12,
    190190          Visible = false,
    191           Top = (int)(gradientChart.Height * 0.1),
     191          Top = (int)(plot.Height * 0.1),
    192192        };
    193193        densityCharts.Add(variableName, densityChart);
    194         gradientChart.ZoomChanged += (o, e) => {
    195           var gradient = (FactorGradientChart)o;
    196           var density = densityCharts[gradient.FreeVariable];
    197           density.Visible = densityComboBox.SelectedIndex != 0 && !gradient.IsZoomed;
     194        plot.ZoomChanged += (o, e) => {
     195          var pdp = (FactorPartialDependencePlot)o;
     196          var density = densityCharts[pdp.FreeVariable];
     197          density.Visible = densityComboBox.SelectedIndex != 0 && !pdp.IsZoomed;
    198198          if (density.Visible)
    199             UpdateDensityChart(density, gradient.FreeVariable);
    200         };
    201         gradientChart.SizeChanged += (o, e) => {
    202           var gradient = (FactorGradientChart)o;
    203           var density = densityCharts[gradient.FreeVariable];
    204           density.Top = (int)(gradient.Height * 0.1);
     199            UpdateDensityChart(density, pdp.FreeVariable);
     200        };
     201        plot.SizeChanged += (o, e) => {
     202          var pdp = (FactorPartialDependencePlot)o;
     203          var density = densityCharts[pdp.FreeVariable];
     204          density.Top = (int)(pdp.Height * 0.1);
    205205        };
    206206
    207207        // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...)
    208208        // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting.
    209         gradientChart.ChartPostPaint += OnFactorGradientChartPostPaint;
     209        plot.ChartPostPaint += OnFactorPartialDependencePlotPostPaint;
    210210
    211211        var panel = new Panel() {
     
    216216
    217217        panel.Controls.Add(densityChart);
    218         panel.Controls.Add(gradientChart);
     218        panel.Controls.Add(plot);
    219219        groupingPanels.Add(variableName, panel);
    220220      }
     
    237237      double yValue = Content.Model.GetEstimatedValues(sharedFixedVariables, new[] { 0 }).Single();
    238238      string title = Content.ProblemData.TargetVariable + ": " + yValue.ToString("G5", CultureInfo.CurrentCulture);
    239       foreach (var chart in gradientCharts.Values) {
     239      foreach (var chart in partialDependencePlots.Values) {
    240240        if (!string.IsNullOrEmpty(chart.YAxisTitle)) { // only show title for first column in grid
    241241          chart.YAxisTitle = title;
     
    245245
    246246
    247     private void OnGradientChartPostPaint(object o, EventArgs e) {
    248       var gradient = (GradientChart)o;
    249       var density = densityCharts[gradient.FreeVariable];
    250 
    251       density.Width = gradient.Width;
    252 
    253       var gcPlotPosition = gradient.InnerPlotPosition;
    254       density.Left = (int)(gcPlotPosition.X / 100.0 * gradient.Width);
    255       density.Width = (int)(gcPlotPosition.Width / 100.0 * gradient.Width);
    256       gradient.UpdateTitlePosition();
     247    private void OnPartialDependencePlotPostPaint(object o, EventArgs e) {
     248      var plot = (PartialDependencePlot)o;
     249      var density = densityCharts[plot.FreeVariable];
     250
     251      density.Width = plot.Width;
     252
     253      var gcPlotPosition = plot.InnerPlotPosition;
     254      density.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width);
     255      density.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width);
     256      plot.UpdateTitlePosition();
    257257
    258258      // removed after succesful layouting due to performance reasons
    259259      if (gcPlotPosition.Width != 0)
    260         gradient.ChartPostPaint -= OnGradientChartPostPaint;
    261     }
    262 
    263     private void OnFactorGradientChartPostPaint(object o, EventArgs e) {
    264       var gradient = (FactorGradientChart)o;
    265       var density = densityCharts[gradient.FreeVariable];
    266 
    267       density.Width = gradient.Width;
    268 
    269       var gcPlotPosition = gradient.InnerPlotPosition;
    270       density.Left = (int)(gcPlotPosition.X / 100.0 * gradient.Width);
    271       density.Width = (int)(gcPlotPosition.Width / 100.0 * gradient.Width);
    272       gradient.UpdateTitlePosition();
     260        plot.ChartPostPaint -= OnPartialDependencePlotPostPaint;
     261    }
     262
     263    private void OnFactorPartialDependencePlotPostPaint(object o, EventArgs e) {
     264      var plot = (FactorPartialDependencePlot)o;
     265      var density = densityCharts[plot.FreeVariable];
     266
     267      density.Width = plot.Width;
     268
     269      var gcPlotPosition = plot.InnerPlotPosition;
     270      density.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width);
     271      density.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width);
     272      plot.UpdateTitlePosition();
    273273
    274274      // removed after succesful layouting due to performance reasons
    275275      if (gcPlotPosition.Width != 0)
    276         gradient.ChartPostPaint -= OnFactorGradientChartPostPaint;
     276        plot.ChartPostPaint -= OnFactorPartialDependencePlotPostPaint;
    277277    }
    278278
    279279    private async void RecalculateAndRelayoutCharts() {
    280280      foreach (var variable in VisibleVariables) {
    281         var gradientChart = gradientCharts[variable];
    282         await gradientChart.RecalculateAsync(false, false);
    283       }
    284       gradientChartTableLayout.SuspendLayout();
     281        var plot = partialDependencePlots[variable];
     282        await plot.RecalculateAsync(false, false);
     283      }
     284      partialDependencePlotTableLayout.SuspendLayout();
    285285      SetupYAxis();
    286286      ReOrderControls();
    287287      SetStyles();
    288       gradientChartTableLayout.ResumeLayout();
    289       gradientChartTableLayout.Refresh();
     288      partialDependencePlotTableLayout.ResumeLayout();
     289      partialDependencePlotTableLayout.Refresh();
    290290      foreach (var variable in VisibleVariables) {
    291291        DensityChart densityChart;
     
    295295      }
    296296    }
    297     private GradientChart CreateGradientChart(string variableName, ModifiableDataset sharedFixedVariables) {
    298       var gradientChart = new GradientChart {
     297    private PartialDependencePlot CreatePartialDependencePlot(string variableName, ModifiableDataset sharedFixedVariables) {
     298      var plot = new PartialDependencePlot {
    299299        Dock = DockStyle.Fill,
    300300        Margin = Padding.Empty,
     
    304304        YAxisTicks = 5,
    305305      };
    306       gradientChart.VariableValueChanged += async (o, e) => {
    307         var recalculations = VisibleGradientCharts
    308           .Except(new[] { (IGradientChart)o })
     306      plot.VariableValueChanged += async (o, e) => {
     307        var recalculations = VisiblePartialDependencePlots
     308          .Except(new[] { (IPartialDependencePlot)o })
    309309          .Select(async chart => {
    310310            await chart.RecalculateAsync(updateOnFinish: false, resetYAxis: false);
     
    315315          SetupYAxis();
    316316      };
    317       gradientChart.Configure(new[] { Content }, sharedFixedVariables, variableName, Points);
    318       gradientChart.SolutionAdded += gradientChart_SolutionAdded;
    319       gradientChart.SolutionRemoved += gradientChart_SolutionRemoved;
    320       return gradientChart;
    321     }
    322     private FactorGradientChart CreateFactorGradientChart(string variableName, ModifiableDataset sharedFixedVariables) {
    323       var gradientChart = new FactorGradientChart {
     317      plot.Configure(new[] { Content }, sharedFixedVariables, variableName, Points);
     318      plot.SolutionAdded += partialDependencePlot_SolutionAdded;
     319      plot.SolutionRemoved += partialDependencePlot_SolutionRemoved;
     320      return plot;
     321    }
     322    private FactorPartialDependencePlot CreateFactorPartialDependencePlot(string variableName, ModifiableDataset sharedFixedVariables) {
     323      var plot = new FactorPartialDependencePlot {
    324324        Dock = DockStyle.Fill,
    325325        Margin = Padding.Empty,
     
    328328        YAxisTicks = 5,
    329329      };
    330       gradientChart.VariableValueChanged += async (o, e) => {
    331         var recalculations = VisibleGradientCharts
    332           .Except(new[] { (FactorGradientChart)o })
     330      plot.VariableValueChanged += async (o, e) => {
     331        var recalculations = VisiblePartialDependencePlots
     332          .Except(new[] { (FactorPartialDependencePlot)o })
    333333          .Select(async chart => {
    334334            await chart.RecalculateAsync(updateOnFinish: false, resetYAxis: false);
     
    340340      };
    341341      var variableValues = Content.ProblemData.Dataset.GetStringValues(variableName).Distinct().OrderBy(n => n).ToList();
    342       gradientChart.Configure(new[] { Content }, sharedFixedVariables, variableName, variableValues);
    343       gradientChart.SolutionAdded += gradientChart_SolutionAdded;
    344       gradientChart.SolutionRemoved += gradientChart_SolutionRemoved;
    345       return gradientChart;
     342      plot.Configure(new[] { Content }, sharedFixedVariables, variableName, variableValues);
     343      plot.SolutionAdded += partialDependencePlot_SolutionAdded;
     344      plot.SolutionRemoved += partialDependencePlot_SolutionRemoved;
     345      return plot;
    346346    }
    347347    private void SetupYAxis() {
     
    349349      if (automaticYAxisCheckBox.Checked) {
    350350        double min = double.MaxValue, max = double.MinValue;
    351         foreach (var chart in VisibleGradientCharts) {
     351        foreach (var chart in VisiblePartialDependencePlots) {
    352352          if (chart.YMin < min) min = chart.YMin;
    353353          if (chart.YMax > max) max = chart.YMax;
     
    361361      }
    362362
    363       foreach (var chart in VisibleGradientCharts) {
     363      foreach (var chart in VisiblePartialDependencePlots) {
    364364        chart.FixedYAxisMin = axisMin;
    365365        chart.FixedYAxisMax = axisMax;
     
    370370    // the table layout containing the controls should be suspended before calling this method
    371371    private void ReOrderControls() {
    372       var tl = gradientChartTableLayout;
     372      var tl = partialDependencePlotTableLayout;
    373373      tl.Controls.Clear();
    374374      int row = 0, column = 0;
     
    380380        tl.Controls.Add(chartsPanel, column, row);
    381381
    382         var chart = gradientCharts[v];
     382        var chart = partialDependencePlots[v];
    383383        chart.YAxisTitle = column == 0 ? title : string.Empty;
    384384        column++;
     
    392392
    393393    private void SetStyles() {
    394       var tl = gradientChartTableLayout;
     394      var tl = partialDependencePlotTableLayout;
    395395      tl.RowStyles.Clear();
    396396      tl.ColumnStyles.Clear();
     
    412412    }
    413413
    414     private async void gradientChart_SolutionAdded(object sender, EventArgs<IRegressionSolution> e) {
     414    private async void partialDependencePlot_SolutionAdded(object sender, EventArgs<IRegressionSolution> e) {
    415415      var solution = e.Value;
    416       foreach (var chart in gradientCharts.Values) {
     416      foreach (var chart in partialDependencePlots.Values) {
    417417        if (sender == chart) continue;
    418418        await chart.AddSolutionAsync(solution);
     
    420420    }
    421421
    422     private async void gradientChart_SolutionRemoved(object sender, EventArgs<IRegressionSolution> e) {
     422    private async void partialDependencePlot_SolutionRemoved(object sender, EventArgs<IRegressionSolution> e) {
    423423      var solution = e.Value;
    424       foreach (var chart in gradientCharts.Values) {
     424      foreach (var chart in partialDependencePlots.Values) {
    425425        if (sender == chart) continue;
    426426        await chart.RemoveSolutionAsync(solution);
     
    431431      var item = e.Item;
    432432      var variable = item.Text;
    433       var gradientChart = gradientCharts[variable];
     433      var plot = partialDependencePlots[variable];
    434434      var chartsPanel = groupingPanels[variable];
    435       var tl = gradientChartTableLayout;
     435      var tl = partialDependencePlotTableLayout;
    436436
    437437      tl.SuspendLayout();
    438438      if (item.Checked) {
    439439        tl.Controls.Add(chartsPanel);
    440         await gradientChart.RecalculateAsync(false, false);
     440        await plot.RecalculateAsync(false, false);
    441441      } else {
    442442        tl.Controls.Remove(chartsPanel);
     
    456456      limitView.ReadOnly = automaticYAxisCheckBox.Checked;
    457457      SetupYAxis();
    458       gradientChartTableLayout.Refresh();
     458      partialDependencePlotTableLayout.Refresh();
    459459      densityComboBox_SelectedIndexChanged(this, EventArgs.Empty); // necessary to realign the density plots
    460460    }
     
    464464        return;
    465465      SetupYAxis();
    466       gradientChartTableLayout.Refresh();
     466      partialDependencePlotTableLayout.Refresh();
    467467      densityComboBox_SelectedIndexChanged(this, EventArgs.Empty); // necessary to realign the density plots
    468468    }
     
    482482          var variableName = entry.Key;
    483483          var densityChart = entry.Value;
    484           if (!VisibleVariables.Contains(variableName) || gradientCharts[variableName].IsZoomed)
     484          if (!VisibleVariables.Contains(variableName) || partialDependencePlots[variableName].IsZoomed)
    485485            continue;
    486486
     
    504504      if (Content.ProblemData.Dataset.VariableHasType<double>(variable)) {
    505505        var data = Content.ProblemData.Dataset.GetDoubleValues(variable, indices).ToList();
    506         var gradientChart = gradientCharts[variable] as GradientChart;
    507         if (gradientChart != null) {
    508           var min = gradientChart.FixedXAxisMin;
    509           var max = gradientChart.FixedXAxisMax;
    510           var buckets = gradientChart.DrawingSteps;
     506        var plot = partialDependencePlots[variable] as PartialDependencePlot;
     507        if (plot != null) {
     508          var min = plot.FixedXAxisMin;
     509          var max = plot.FixedXAxisMax;
     510          var buckets = plot.DrawingSteps;
    511511          if (min.HasValue && max.HasValue) {
    512512            densityChart.UpdateChart(data, min.Value, max.Value, buckets);
    513             densityChart.Width = gradientChart.Width;
    514 
    515             var gcPlotPosition = gradientChart.InnerPlotPosition;
    516             densityChart.Left = (int)(gcPlotPosition.X / 100.0 * gradientChart.Width);
    517             densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * gradientChart.Width);
     513            densityChart.Width = plot.Width;
     514
     515            var gcPlotPosition = plot.InnerPlotPosition;
     516            densityChart.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width);
     517            densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width);
    518518
    519519            densityChart.Visible = true;
    520520          }
    521           gradientChart.UpdateTitlePosition();
     521          plot.UpdateTitlePosition();
    522522        }
    523523      } else if (Content.ProblemData.Dataset.VariableHasType<string>(variable)) {
    524524        var data = Content.ProblemData.Dataset.GetStringValues(variable).ToList();
    525         var gradientChart = gradientCharts[variable] as FactorGradientChart;
    526         if (gradientChart != null) {
     525        var plot = partialDependencePlots[variable] as FactorPartialDependencePlot;
     526        if (plot != null) {
    527527          densityChart.UpdateChart(data);
    528           densityChart.Width = gradientChart.Width;
    529 
    530           var gcPlotPosition = gradientChart.InnerPlotPosition;
    531           densityChart.Left = (int)(gcPlotPosition.X / 100.0 * gradientChart.Width);
    532           densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * gradientChart.Width);
     528          densityChart.Width = plot.Width;
     529
     530          var gcPlotPosition = plot.InnerPlotPosition;
     531          densityChart.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width);
     532          densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width);
    533533
    534534          densityChart.Visible = true;
    535535
    536           gradientChart.UpdateTitlePosition();
     536          plot.UpdateTitlePosition();
    537537        }
    538538      }
     
    543543      int columns = Math.Min(VisibleVariables.Count(), MaxColumns);
    544544      if (columns > 0) {
    545         var tl = gradientChartTableLayout;
     545        var tl = partialDependencePlotTableLayout;
    546546        MaxColumns = columns;
    547547        tl.SuspendLayout();
     
    556556    private async void solution_ModelChanged(object sender, EventArgs e) {
    557557      foreach (var variable in VisibleVariables) {
    558         var gradientChart = gradientCharts[variable];
     558        var pdp = partialDependencePlots[variable];
    559559        var densityChart = densityCharts[variable];
    560560        // recalculate and refresh
    561         await gradientChart.RecalculateAsync(false, false);
    562         gradientChart.Refresh();
     561        await pdp.RecalculateAsync(false, false);
     562        pdp.Refresh();
    563563        UpdateDensityChart(densityChart, variable);
    564564      }
Note: See TracChangeset for help on using the changeset viewer.