Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14021


Ignore:
Timestamp:
07/07/16 19:31:49 (8 years ago)
Author:
bburlacu
Message:

#2597: Fixed some additional issues with the density charts (which are now turned on by default).

Location:
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs

    r14014 r14021  
    142142        if ((value.HasValue && fixedYAxisMin.HasValue && !value.Value.IsAlmost(fixedYAxisMin.Value)) || (value.HasValue != fixedYAxisMin.HasValue)) {
    143143          fixedYAxisMin = value;
    144           // the check below prevents an exception when yMin >= yMax
    145           if (yMin < yMax)
    146             SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
     144          SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
    147145        }
    148146      }
     
    154152        if ((value.HasValue && fixedYAxisMax.HasValue && !value.Value.IsAlmost(fixedYAxisMax.Value)) || (value.HasValue != fixedYAxisMax.HasValue)) {
    155153          fixedYAxisMax = value;
    156           // the check below prevents an exception when yMin >= yMax
    157           if (yMin < yMax)
    158             SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
     154          SetupAxis(chart.ChartAreas[0].AxisY, yMin, yMax, YAxisTicks, FixedYAxisMin, FixedYAxisMax);
    159155        }
    160156      }
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.Designer.cs

    r14014 r14021  
    6060      this.variableListView.UseCompatibleStateImageBehavior = false;
    6161      this.variableListView.View = System.Windows.Forms.View.List;
     62      this.variableListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.variableListView_ItemChecked);
    6263      //
    6364      // gradientChartTableLayout
     
    109110      this.automaticYAxisCheckBox.Text = "Automatic";
    110111      this.automaticYAxisCheckBox.UseVisualStyleBackColor = true;
     112      this.automaticYAxisCheckBox.CheckedChanged += new System.EventHandler(this.automaticYAxisCheckBox_CheckedChanged);
    111113      //
    112114      // densityGroupBox
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.cs

    r14014 r14021  
    6464
    6565      limitView.Content = new DoubleLimit(0, 1);
    66       densityComboBox.SelectedIndex = 0; // select None
     66      limitView.Content.ValueChanged += limit_ValueChanged;
     67
     68      densityComboBox.SelectedIndex = 1; // select Training
    6769
    6870      columnsTextBox.Text = "4";
     
    8183    protected override void RegisterContentEvents() {
    8284      base.RegisterContentEvents();
    83       variableListView.ItemChecked += variableListView_ItemChecked;
    84       limitView.Content.ValueChanged += limit_ValueChanged;
    85       automaticYAxisCheckBox.CheckedChanged += automaticYAxisCheckBox_CheckedChanged;
    8685      Content.ModelChanged += solution_ModelChanged;
    8786    }
    8887
    8988    protected override void DeregisterContentEvents() {
    90       variableListView.ItemChecked -= variableListView_ItemChecked;
    91       limitView.Content.ValueChanged -= limit_ValueChanged;
    92       automaticYAxisCheckBox.CheckedChanged -= automaticYAxisCheckBox_CheckedChanged;
    9389      Content.ModelChanged -= solution_ModelChanged;
    9490      base.DeregisterContentEvents();
     
    149145
    150146      // update variable list
     147      variableListView.ItemChecked -= variableListView_ItemChecked;
    151148      variableListView.Items.Clear();
    152149      foreach (var variable in allowedInputVariables)
     
    155152      foreach (var variable in Content.Model.VariablesUsedForPrediction)
    156153        variableListView.Items[variable].Checked = true;
     154      variableListView.ItemChecked += variableListView_ItemChecked;
     155
     156      RecalculateAndRelayoutCharts();
     157    }
     158
     159    private async void RecalculateAndRelayoutCharts() {
     160      foreach (var variable in VisibleVariables) {
     161        var gradientChart = gradientCharts[variable];
     162        await gradientChart.RecalculateAsync();
     163      }
     164      gradientChartTableLayout.SuspendLayout();
     165      SetupYAxis();
     166      ReOrderControls();
     167      SetStyles();
     168      gradientChartTableLayout.ResumeLayout();
     169      gradientChartTableLayout.Refresh();
     170      foreach (var variable in VisibleVariables) {
     171        var densityChart = densityCharts[variable];
     172        UpdateDensityChart(densityChart, variable);
     173      }
    157174    }
    158175    private GradientChart CreateGradientChart(string variableName, ModifiableDataset sharedFixedVariables) {
     
    199216        chart.FixedYAxisMin = axisMin;
    200217        chart.FixedYAxisMax = axisMax;
    201         //chart.Update();
    202218      }
    203219    }
     
    213229        tl.Controls.Add(chartsPanel, column, row);
    214230
    215         if (column == 0) {
    216           var chart = gradientCharts[v];
    217           chart.YAxisTitle = Content.ProblemData.TargetVariable;
    218         }
    219 
     231        var chart = gradientCharts[v];
     232        chart.YAxisTitle = column == 0 ? Content.ProblemData.TargetVariable : string.Empty;
    220233        column++;
    221234
     
    268281      var variable = item.Text;
    269282      var gradientChart = gradientCharts[variable];
    270       var densityChart = densityCharts[variable];
    271283      var chartsPanel = groupingPanels[variable];
    272284      var tl = gradientChartTableLayout;
     
    276288        tl.Controls.Add(chartsPanel);
    277289        await gradientChart.RecalculateAsync();
    278         UpdateDensityChart(densityChart, variable);
    279290      } else {
    280291        tl.Controls.Remove(chartsPanel);
     
    287298      }
    288299      tl.ResumeLayout();
     300      tl.Refresh();
     301      densityComboBox_SelectedIndexChanged(this, EventArgs.Empty);
    289302    }
    290303
     
    292305      limitView.ReadOnly = automaticYAxisCheckBox.Checked;
    293306      SetupYAxis();
     307      gradientChartTableLayout.Refresh();
     308      densityComboBox_SelectedIndexChanged(this, EventArgs.Empty); // necessary to realign the density plots
    294309    }
    295310
     
    298313        return;
    299314      SetupYAxis();
     315      gradientChartTableLayout.Refresh();
     316      densityComboBox_SelectedIndexChanged(this, EventArgs.Empty); // necessary to realign the density plots
    300317    }
    301318
    302319    private void densityComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     320      if (Content == null)
     321        return;
     322
    303323      int si = densityComboBox.SelectedIndex;
    304324      if (si == 0) {
     
    369389        ReOrderControls();
    370390        SetStyles();
    371         tl.ResumeLayout(true);
    372       }
    373     }
    374 
    375     private void solution_ModelChanged(object sender, EventArgs e) {
    376       foreach (var chart in gradientCharts.Values) {
    377         chart.RecalculateAsync();
     391        tl.ResumeLayout();
     392        tl.Refresh();
     393        densityComboBox_SelectedIndexChanged(this, EventArgs.Empty);
     394      }
     395    }
     396
     397    private async void solution_ModelChanged(object sender, EventArgs e) {
     398      foreach (var variable in VisibleVariables) {
     399        var gradientChart = gradientCharts[variable];
     400        var densityChart = densityCharts[variable];
     401        // recalculate and refresh
     402        await gradientChart.RecalculateAsync();
     403        gradientChart.Refresh();
     404        UpdateDensityChart(densityChart, variable);
    378405      }
    379406    }
Note: See TracChangeset for help on using the changeset viewer.