Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14514


Ignore:
Timestamp:
12/21/16 11:26:54 (7 years ago)
Author:
pfleck
Message:

#2709

  • Added a VerticalLabel for the multi-scatterplot.
  • Added regression options for single- and multi-scatterplot
Location:
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj

    r14511 r14514  
    297297    <Compile Include="Utils\FindPreprocessingItemsIterator.cs" />
    298298    <Compile Include="Utils\IFindPreprocessingItemsIterator.cs" />
     299    <Compile Include="Utils\VerticalLabel.cs">
     300      <SubType>Component</SubType>
     301    </Compile>
    299302    <Compile Include="ViewShortcutListView.cs">
    300303      <SubType>UserControl</SubType>
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.Designer.cs

    r14511 r14514  
    4747      this.components = new System.ComponentModel.Container();
    4848      this.splitContainer = new System.Windows.Forms.SplitContainer();
    49       this.groupBox1 = new System.Windows.Forms.GroupBox();
     49      this.variablesGroupBox = new System.Windows.Forms.GroupBox();
    5050      this.uncheckAllButton = new System.Windows.Forms.Button();
    5151      this.checkAllButton = new System.Windows.Forms.Button();
     
    5757      this.splitContainer.Panel1.SuspendLayout();
    5858      this.splitContainer.SuspendLayout();
    59       this.groupBox1.SuspendLayout();
     59      this.variablesGroupBox.SuspendLayout();
    6060      this.SuspendLayout();
    6161      //
     
    6969      // splitContainer.Panel1
    7070      //
    71       this.splitContainer.Panel1.Controls.Add(this.groupBox1);
     71      this.splitContainer.Panel1.Controls.Add(this.variablesGroupBox);
    7272      this.splitContainer.Size = new System.Drawing.Size(654, 403);
    7373      this.splitContainer.SplitterDistance = 180;
    7474      this.splitContainer.TabIndex = 7;
    7575      //
    76       // groupBox1
     76      // variablesGroupBox
    7777      //
    78       this.groupBox1.Controls.Add(this.uncheckAllButton);
    79       this.groupBox1.Controls.Add(this.checkAllButton);
    80       this.groupBox1.Controls.Add(this.checkInputsTargetButton);
    81       this.groupBox1.Controls.Add(this.variablesListView);
    82       this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
    83       this.groupBox1.Location = new System.Drawing.Point(0, 0);
    84       this.groupBox1.Name = "groupBox1";
    85       this.groupBox1.Size = new System.Drawing.Size(180, 403);
    86       this.groupBox1.TabIndex = 7;
    87       this.groupBox1.TabStop = false;
    88       this.groupBox1.Text = "Variables";
     78      this.variablesGroupBox.Controls.Add(this.uncheckAllButton);
     79      this.variablesGroupBox.Controls.Add(this.checkAllButton);
     80      this.variablesGroupBox.Controls.Add(this.checkInputsTargetButton);
     81      this.variablesGroupBox.Controls.Add(this.variablesListView);
     82      this.variablesGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
     83      this.variablesGroupBox.Location = new System.Drawing.Point(0, 0);
     84      this.variablesGroupBox.Name = "variablesGroupBox";
     85      this.variablesGroupBox.Size = new System.Drawing.Size(180, 403);
     86      this.variablesGroupBox.TabIndex = 7;
     87      this.variablesGroupBox.TabStop = false;
     88      this.variablesGroupBox.Text = "Variables";
    8989      //
    9090      // uncheckAllButton
     
    153153      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    154154      this.splitContainer.ResumeLayout(false);
    155       this.groupBox1.ResumeLayout(false);
     155      this.variablesGroupBox.ResumeLayout(false);
    156156      this.ResumeLayout(false);
    157157
     
    161161    protected System.Windows.Forms.SplitContainer splitContainer;
    162162    private System.Windows.Forms.ListView variablesListView;
    163     private System.Windows.Forms.GroupBox groupBox1;
     163    private System.Windows.Forms.GroupBox variablesGroupBox;
    164164    private System.Windows.Forms.ToolTip toolTip;
    165165    private System.Windows.Forms.ColumnHeader columnHeader;
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs

    r14511 r14514  
    5757      this.heightTrackBar = new System.Windows.Forms.TrackBar();
    5858      this.widthTrackBar = new System.Windows.Forms.TrackBar();
     59      this.regressionGroupBox = new System.Windows.Forms.GroupBox();
     60      this.regressionTypeComboBox = new System.Windows.Forms.ComboBox();
     61      this.polynomialRegressionOrderNumericUpDown = new System.Windows.Forms.NumericUpDown();
     62      this.orderLabel = new System.Windows.Forms.Label();
     63      this.label4 = new System.Windows.Forms.Label();
    5964      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    6065      this.splitContainer.Panel1.SuspendLayout();
     
    6873      ((System.ComponentModel.ISupportInitialize)(this.heightTrackBar)).BeginInit();
    6974      ((System.ComponentModel.ISupportInitialize)(this.widthTrackBar)).BeginInit();
     75      this.regressionGroupBox.SuspendLayout();
     76      ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).BeginInit();
    7077      this.SuspendLayout();
    7178      //
     
    7683      //
    7784      this.splitContainer.Panel1.Controls.Add(this.sizeGroupBox);
     85      this.splitContainer.Panel1.Controls.Add(this.regressionGroupBox);
    7886      //
    7987      // splitContainer.Panel2
     
    187195      this.sizeGroupBox.Controls.Add(this.widthTrackBar);
    188196      this.sizeGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
    189       this.sizeGroupBox.Location = new System.Drawing.Point(0, 267);
     197      this.sizeGroupBox.Location = new System.Drawing.Point(0, 198);
    190198      this.sizeGroupBox.Name = "sizeGroupBox";
    191       this.sizeGroupBox.Size = new System.Drawing.Size(180, 136);
     199      this.sizeGroupBox.Size = new System.Drawing.Size(180, 130);
    192200      this.sizeGroupBox.TabIndex = 5;
    193201      this.sizeGroupBox.TabStop = false;
     
    241249      this.widthTrackBar.Value = 20;
    242250      this.widthTrackBar.ValueChanged += new System.EventHandler(this.widthTrackBar_ValueChanged);
     251      //
     252      // regressionGroupBox
     253      //
     254      this.regressionGroupBox.Controls.Add(this.regressionTypeComboBox);
     255      this.regressionGroupBox.Controls.Add(this.polynomialRegressionOrderNumericUpDown);
     256      this.regressionGroupBox.Controls.Add(this.orderLabel);
     257      this.regressionGroupBox.Controls.Add(this.label4);
     258      this.regressionGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
     259      this.regressionGroupBox.Location = new System.Drawing.Point(0, 328);
     260      this.regressionGroupBox.Name = "regressionGroupBox";
     261      this.regressionGroupBox.Size = new System.Drawing.Size(180, 75);
     262      this.regressionGroupBox.TabIndex = 3;
     263      this.regressionGroupBox.TabStop = false;
     264      this.regressionGroupBox.Text = "Regression";
     265      //
     266      // regressionTypeComboBox
     267      //
     268      this.regressionTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     269            | System.Windows.Forms.AnchorStyles.Right)));
     270      this.regressionTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     271      this.regressionTypeComboBox.FormattingEnabled = true;
     272      this.regressionTypeComboBox.Location = new System.Drawing.Point(67, 19);
     273      this.regressionTypeComboBox.Name = "regressionTypeComboBox";
     274      this.regressionTypeComboBox.Size = new System.Drawing.Size(107, 21);
     275      this.regressionTypeComboBox.TabIndex = 14;
     276      this.regressionTypeComboBox.SelectedValueChanged += new System.EventHandler(this.regressionTypeComboBox_SelectedValueChanged);
     277      //
     278      // polynomialRegressionOrderNumericUpDown
     279      //
     280      this.polynomialRegressionOrderNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     281            | System.Windows.Forms.AnchorStyles.Right)));
     282      this.polynomialRegressionOrderNumericUpDown.Location = new System.Drawing.Point(67, 45);
     283      this.polynomialRegressionOrderNumericUpDown.Margin = new System.Windows.Forms.Padding(9, 3, 3, 3);
     284      this.polynomialRegressionOrderNumericUpDown.Maximum = new decimal(new int[] {
     285            6,
     286            0,
     287            0,
     288            0});
     289      this.polynomialRegressionOrderNumericUpDown.Minimum = new decimal(new int[] {
     290            2,
     291            0,
     292            0,
     293            0});
     294      this.polynomialRegressionOrderNumericUpDown.Name = "polynomialRegressionOrderNumericUpDown";
     295      this.polynomialRegressionOrderNumericUpDown.Size = new System.Drawing.Size(107, 20);
     296      this.polynomialRegressionOrderNumericUpDown.TabIndex = 15;
     297      this.polynomialRegressionOrderNumericUpDown.Value = new decimal(new int[] {
     298            2,
     299            0,
     300            0,
     301            0});
     302      this.polynomialRegressionOrderNumericUpDown.ValueChanged += new System.EventHandler(this.polynomialRegressionOrderNumericUpDown_ValueChanged);
     303      //
     304      // orderLabel
     305      //
     306      this.orderLabel.AutoSize = true;
     307      this.orderLabel.Location = new System.Drawing.Point(6, 47);
     308      this.orderLabel.Name = "orderLabel";
     309      this.orderLabel.Size = new System.Drawing.Size(36, 13);
     310      this.orderLabel.TabIndex = 16;
     311      this.orderLabel.Text = "Order:";
     312      //
     313      // label4
     314      //
     315      this.label4.AutoSize = true;
     316      this.label4.Location = new System.Drawing.Point(6, 22);
     317      this.label4.Name = "label4";
     318      this.label4.Size = new System.Drawing.Size(34, 13);
     319      this.label4.TabIndex = 13;
     320      this.label4.Text = "Type:";
    243321      //
    244322      // ScatterPlotMultiView
     
    262340      ((System.ComponentModel.ISupportInitialize)(this.heightTrackBar)).EndInit();
    263341      ((System.ComponentModel.ISupportInitialize)(this.widthTrackBar)).EndInit();
     342      this.regressionGroupBox.ResumeLayout(false);
     343      this.regressionGroupBox.PerformLayout();
     344      ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).EndInit();
    264345      this.ResumeLayout(false);
    265346
     
    280361    private System.Windows.Forms.Label heightLabel;
    281362    private System.Windows.Forms.Label widthLabel;
     363    private System.Windows.Forms.GroupBox regressionGroupBox;
     364    private System.Windows.Forms.ComboBox regressionTypeComboBox;
     365    private System.Windows.Forms.NumericUpDown polynomialRegressionOrderNumericUpDown;
     366    private System.Windows.Forms.Label orderLabel;
     367    private System.Windows.Forms.Label label4;
    282368  }
    283369}
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r14511 r14514  
    1010using HeuristicLab.MainForm;
    1111using HeuristicLab.MainForm.WindowsForms;
     12using RegressionType = HeuristicLab.Analysis.ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType;
    1213
    1314namespace HeuristicLab.DataPreprocessing.Views {
     
    1617  public partial class ScatterPlotMultiView : PreprocessingCheckedVariablesView {
    1718    private readonly IDictionary<string, Label> columnHeaderCache;
    18     private readonly IDictionary<string, Label> rowHeaderCache;
     19    private readonly IDictionary<string, VerticalLabel> rowHeaderCache;
    1920    private readonly IDictionary<Tuple<string/*col*/, string/*row*/>, Control> bodyCache;
    2021
    2122    public ScatterPlotMultiView() {
    2223      InitializeComponent();
     24
     25      regressionTypeComboBox.DataSource = Enum.GetValues(typeof(RegressionType));
     26      regressionTypeComboBox.SelectedItem = RegressionType.None;
    2327
    2428      #region Initialize Scrollbars
     
    4145
    4246      columnHeaderCache = new Dictionary<string, Label>();
    43       rowHeaderCache = new Dictionary<string, Label>();
     47      rowHeaderCache = new Dictionary<string, VerticalLabel>();
    4448      bodyCache = new Dictionary<Tuple<string, string>, Control>();
    4549
     
    5761        GenerateCharts();
    5862      }
     63    }
     64
     65    protected override void SetEnabledStateOfControls() {
     66      base.SetEnabledStateOfControls();
     67      var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
     68      polynomialRegressionOrderNumericUpDown.Enabled = regressionType == RegressionType.Polynomial;
    5969    }
    6070
     
    239249    private Label GetRowHeader(string variable) {
    240250      if (!rowHeaderCache.ContainsKey(variable)) {
    241         rowHeaderCache.Add(variable, new Label() {
     251        rowHeaderCache.Add(variable, new VerticalLabel() {
    242252          Text = variable,
    243253          TextAlign = ContentAlignment.MiddleCenter,
    244254          Name = variable,
    245255          Width = rowHeaderTableLayoutPanel.Width,
     256          Height = columnHeaderScrollPanel.Width,
    246257          Dock = DockStyle.Fill,
    247258          Margin = new Padding(3)
     
    269280        } else { //scatter plot
    270281          var scatterPlot = Content.CreateScatterPlot(colVariable, rowVariable);
    271           foreach (var row in scatterPlot.Rows)
     282          var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
     283          int order = (int)polynomialRegressionOrderNumericUpDown.Value;
     284          foreach (var row in scatterPlot.Rows) {
    272285            row.VisualProperties.PointSize = 3;
     286            row.VisualProperties.IsRegressionVisibleInLegend = false;
     287            row.VisualProperties.RegressionType = regressionType;
     288            row.VisualProperties.PolynomialRegressionOrder = order;
     289          }
    273290          scatterPlot.VisualProperties.Title = string.Empty;
    274           var scatterPlotControl = new /*Preprocessing*/ScatterPlotControl {
     291          var scatterPlotControl = new ScatterPlotControl {
    275292            Name = key.ToString(),
    276293            Content = scatterPlot,
     
    279296            //XAxisFormat = "G3"
    280297          };
    281           scatterPlotControl.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart
     298          //scatterPlotControl.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart
    282299          bodyCache.Add(key, scatterPlotControl);
    283300        }
     
    348365        c++;
    349366      }
     367      UpdateRegressionLine();
    350368    }
    351369
     
    444462    }
    445463    #endregion
     464
     465    #region Regression Line
     466    private void regressionTypeComboBox_SelectedValueChanged(object sender, EventArgs e) {
     467      var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
     468      polynomialRegressionOrderNumericUpDown.Enabled = regressionType == RegressionType.Polynomial;
     469      UpdateRegressionLine();
     470    }
     471
     472    private void polynomialRegressionOrderNumericUpDown_ValueChanged(object sender, EventArgs e) {
     473      UpdateRegressionLine();
     474    }
     475
     476    private void UpdateRegressionLine() {
     477      var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
     478      int order = (int)polynomialRegressionOrderNumericUpDown.Value;
     479
     480      foreach (var control in bodyCache.Values) {
     481        var scatterPlotControl = control as ScatterPlotControl;
     482        if (scatterPlotControl != null) {
     483          foreach (var row in scatterPlotControl.Content.Rows) {
     484            row.VisualProperties.IsRegressionVisibleInLegend = false;
     485            row.VisualProperties.RegressionType = regressionType;
     486            row.VisualProperties.PolynomialRegressionOrder = order;
     487          }
     488        }
     489      }
     490    }
     491    #endregion
    446492  }
    447493}
     494
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.Designer.cs

    r14470 r14514  
    5353      this.comboBoxYVariable = new System.Windows.Forms.ComboBox();
    5454      this.comboBoxXVariable = new System.Windows.Forms.ComboBox();
     55      this.regressionGroupBox = new System.Windows.Forms.GroupBox();
     56      this.regressionTypeComboBox = new System.Windows.Forms.ComboBox();
     57      this.polynomialRegressionOrderNumericUpDown = new System.Windows.Forms.NumericUpDown();
     58      this.orderLabel = new System.Windows.Forms.Label();
     59      this.label4 = new System.Windows.Forms.Label();
     60      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
    5561      this.groupBox1.SuspendLayout();
     62      this.regressionGroupBox.SuspendLayout();
     63      ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).BeginInit();
     64      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     65      this.splitContainer1.Panel1.SuspendLayout();
     66      this.splitContainer1.Panel2.SuspendLayout();
     67      this.splitContainer1.SuspendLayout();
    5668      this.SuspendLayout();
    5769      //
    5870      // scatterPlotControl
    5971      //
    60       this.scatterPlotControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    61             | System.Windows.Forms.AnchorStyles.Left)
    62             | System.Windows.Forms.AnchorStyles.Right)));
    6372      this.scatterPlotControl.Content = null;
    64       this.scatterPlotControl.Location = new System.Drawing.Point(169, 3);
     73      this.scatterPlotControl.Dock = System.Windows.Forms.DockStyle.Fill;
     74      this.scatterPlotControl.Location = new System.Drawing.Point(0, 0);
    6575      this.scatterPlotControl.Name = "scatterPlotControl";
    66       this.scatterPlotControl.Size = new System.Drawing.Size(689, 509);
     76      this.scatterPlotControl.Size = new System.Drawing.Size(687, 517);
    6777      this.scatterPlotControl.TabIndex = 0;
    6878      //
     
    7585      this.groupBox1.Controls.Add(this.comboBoxYVariable);
    7686      this.groupBox1.Controls.Add(this.comboBoxXVariable);
    77       this.groupBox1.Location = new System.Drawing.Point(3, 3);
     87      this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
     88      this.groupBox1.Location = new System.Drawing.Point(0, 0);
    7889      this.groupBox1.Name = "groupBox1";
    79       this.groupBox1.Size = new System.Drawing.Size(160, 215);
     90      this.groupBox1.Size = new System.Drawing.Size(172, 137);
    8091      this.groupBox1.TabIndex = 1;
    8192      this.groupBox1.TabStop = false;
    82       this.groupBox1.Text = "Options";
     93      this.groupBox1.Text = "Variables";
    8394      //
    8495      // label3
    8596      //
    8697      this.label3.AutoSize = true;
    87       this.label3.Location = new System.Drawing.Point(17, 141);
     98      this.label3.Location = new System.Drawing.Point(6, 97);
    8899      this.label3.Name = "label3";
    89       this.label3.Size = new System.Drawing.Size(36, 13);
     100      this.label3.Size = new System.Drawing.Size(39, 13);
    90101      this.label3.TabIndex = 3;
    91       this.label3.Text = "Group";
     102      this.label3.Text = "Group:";
    92103      //
    93104      // label2
    94105      //
    95106      this.label2.AutoSize = true;
    96       this.label2.Location = new System.Drawing.Point(17, 80);
     107      this.label2.Location = new System.Drawing.Point(6, 63);
    97108      this.label2.Name = "label2";
    98       this.label2.Size = new System.Drawing.Size(55, 13);
     109      this.label2.Size = new System.Drawing.Size(17, 13);
    99110      this.label2.TabIndex = 3;
    100       this.label2.Text = "Y Variable";
     111      this.label2.Text = "Y:";
    101112      //
    102113      // label1
    103114      //
    104115      this.label1.AutoSize = true;
    105       this.label1.Location = new System.Drawing.Point(17, 25);
     116      this.label1.Location = new System.Drawing.Point(6, 29);
    106117      this.label1.Name = "label1";
    107       this.label1.Size = new System.Drawing.Size(55, 13);
     118      this.label1.Size = new System.Drawing.Size(17, 13);
    108119      this.label1.TabIndex = 2;
    109       this.label1.Text = "X Variable";
     120      this.label1.Text = "X:";
    110121      //
    111122      // comboBoxGroup
    112123      //
     124      this.comboBoxGroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     125            | System.Windows.Forms.AnchorStyles.Right)));
    113126      this.comboBoxGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    114127      this.comboBoxGroup.FormattingEnabled = true;
    115       this.comboBoxGroup.Location = new System.Drawing.Point(20, 164);
     128      this.comboBoxGroup.Location = new System.Drawing.Point(51, 94);
    116129      this.comboBoxGroup.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3);
    117130      this.comboBoxGroup.Name = "comboBoxGroup";
    118       this.comboBoxGroup.Size = new System.Drawing.Size(121, 21);
     131      this.comboBoxGroup.Size = new System.Drawing.Size(115, 21);
    119132      this.comboBoxGroup.TabIndex = 1;
    120133      this.comboBoxGroup.SelectedIndexChanged += new System.EventHandler(this.comboBoxGroup_SelectedIndexChanged);
     
    122135      // comboBoxYVariable
    123136      //
     137      this.comboBoxYVariable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     138            | System.Windows.Forms.AnchorStyles.Right)));
    124139      this.comboBoxYVariable.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    125140      this.comboBoxYVariable.FormattingEnabled = true;
    126       this.comboBoxYVariable.Location = new System.Drawing.Point(20, 103);
     141      this.comboBoxYVariable.Location = new System.Drawing.Point(51, 60);
    127142      this.comboBoxYVariable.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3);
    128143      this.comboBoxYVariable.Name = "comboBoxYVariable";
    129       this.comboBoxYVariable.Size = new System.Drawing.Size(121, 21);
     144      this.comboBoxYVariable.Size = new System.Drawing.Size(115, 21);
    130145      this.comboBoxYVariable.TabIndex = 1;
    131146      this.comboBoxYVariable.SelectedIndexChanged += new System.EventHandler(this.comboBoxYVariable_SelectedIndexChanged);
     
    133148      // comboBoxXVariable
    134149      //
     150      this.comboBoxXVariable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     151            | System.Windows.Forms.AnchorStyles.Right)));
    135152      this.comboBoxXVariable.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    136153      this.comboBoxXVariable.FormattingEnabled = true;
    137       this.comboBoxXVariable.Location = new System.Drawing.Point(20, 48);
     154      this.comboBoxXVariable.Location = new System.Drawing.Point(51, 26);
    138155      this.comboBoxXVariable.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3);
    139156      this.comboBoxXVariable.Name = "comboBoxXVariable";
    140       this.comboBoxXVariable.Size = new System.Drawing.Size(121, 21);
     157      this.comboBoxXVariable.Size = new System.Drawing.Size(115, 21);
    141158      this.comboBoxXVariable.TabIndex = 0;
    142159      this.comboBoxXVariable.SelectedIndexChanged += new System.EventHandler(this.comboBoxXVariable_SelectedIndexChanged);
    143160      //
     161      // regressionGroupBox
     162      //
     163      this.regressionGroupBox.Controls.Add(this.regressionTypeComboBox);
     164      this.regressionGroupBox.Controls.Add(this.polynomialRegressionOrderNumericUpDown);
     165      this.regressionGroupBox.Controls.Add(this.orderLabel);
     166      this.regressionGroupBox.Controls.Add(this.label4);
     167      this.regressionGroupBox.Dock = System.Windows.Forms.DockStyle.Top;
     168      this.regressionGroupBox.Location = new System.Drawing.Point(0, 137);
     169      this.regressionGroupBox.Name = "regressionGroupBox";
     170      this.regressionGroupBox.Size = new System.Drawing.Size(172, 78);
     171      this.regressionGroupBox.TabIndex = 4;
     172      this.regressionGroupBox.TabStop = false;
     173      this.regressionGroupBox.Text = "Regression";
     174      //
     175      // regressionTypeComboBox
     176      //
     177      this.regressionTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     178            | System.Windows.Forms.AnchorStyles.Right)));
     179      this.regressionTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     180      this.regressionTypeComboBox.FormattingEnabled = true;
     181      this.regressionTypeComboBox.Location = new System.Drawing.Point(51, 19);
     182      this.regressionTypeComboBox.Name = "regressionTypeComboBox";
     183      this.regressionTypeComboBox.Size = new System.Drawing.Size(115, 21);
     184      this.regressionTypeComboBox.TabIndex = 14;
     185      this.regressionTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.regressionTypeComboBox_SelectedIndexChanged);
     186      //
     187      // polynomialRegressionOrderNumericUpDown
     188      //
     189      this.polynomialRegressionOrderNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     190            | System.Windows.Forms.AnchorStyles.Right)));
     191      this.polynomialRegressionOrderNumericUpDown.Location = new System.Drawing.Point(51, 47);
     192      this.polynomialRegressionOrderNumericUpDown.Margin = new System.Windows.Forms.Padding(9, 3, 3, 3);
     193      this.polynomialRegressionOrderNumericUpDown.Maximum = new decimal(new int[] {
     194            6,
     195            0,
     196            0,
     197            0});
     198      this.polynomialRegressionOrderNumericUpDown.Minimum = new decimal(new int[] {
     199            2,
     200            0,
     201            0,
     202            0});
     203      this.polynomialRegressionOrderNumericUpDown.Name = "polynomialRegressionOrderNumericUpDown";
     204      this.polynomialRegressionOrderNumericUpDown.Size = new System.Drawing.Size(115, 20);
     205      this.polynomialRegressionOrderNumericUpDown.TabIndex = 15;
     206      this.polynomialRegressionOrderNumericUpDown.Value = new decimal(new int[] {
     207            2,
     208            0,
     209            0,
     210            0});
     211      this.polynomialRegressionOrderNumericUpDown.ValueChanged += new System.EventHandler(this.polynomialRegressionOrderNumericUpDown_ValueChanged);
     212      //
     213      // orderLabel
     214      //
     215      this.orderLabel.AutoSize = true;
     216      this.orderLabel.Location = new System.Drawing.Point(6, 49);
     217      this.orderLabel.Name = "orderLabel";
     218      this.orderLabel.Size = new System.Drawing.Size(36, 13);
     219      this.orderLabel.TabIndex = 16;
     220      this.orderLabel.Text = "Order:";
     221      //
     222      // label4
     223      //
     224      this.label4.AutoSize = true;
     225      this.label4.Location = new System.Drawing.Point(6, 22);
     226      this.label4.Name = "label4";
     227      this.label4.Size = new System.Drawing.Size(34, 13);
     228      this.label4.TabIndex = 13;
     229      this.label4.Text = "Type:";
     230      //
     231      // splitContainer1
     232      //
     233      this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
     234      this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
     235      this.splitContainer1.Location = new System.Drawing.Point(0, 0);
     236      this.splitContainer1.Name = "splitContainer1";
     237      //
     238      // splitContainer1.Panel1
     239      //
     240      this.splitContainer1.Panel1.Controls.Add(this.regressionGroupBox);
     241      this.splitContainer1.Panel1.Controls.Add(this.groupBox1);
     242      //
     243      // splitContainer1.Panel2
     244      //
     245      this.splitContainer1.Panel2.Controls.Add(this.scatterPlotControl);
     246      this.splitContainer1.Size = new System.Drawing.Size(863, 517);
     247      this.splitContainer1.SplitterDistance = 172;
     248      this.splitContainer1.TabIndex = 5;
     249      //
    144250      // ScatterPlotSingleView
    145251      //
    146252      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    147253      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    148       this.Controls.Add(this.groupBox1);
    149       this.Controls.Add(this.scatterPlotControl);
     254      this.Controls.Add(this.splitContainer1);
    150255      this.Name = "ScatterPlotSingleView";
    151256      this.Size = new System.Drawing.Size(863, 517);
    152257      this.groupBox1.ResumeLayout(false);
    153258      this.groupBox1.PerformLayout();
     259      this.regressionGroupBox.ResumeLayout(false);
     260      this.regressionGroupBox.PerformLayout();
     261      ((System.ComponentModel.ISupportInitialize)(this.polynomialRegressionOrderNumericUpDown)).EndInit();
     262      this.splitContainer1.Panel1.ResumeLayout(false);
     263      this.splitContainer1.Panel2.ResumeLayout(false);
     264      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     265      this.splitContainer1.ResumeLayout(false);
    154266      this.ResumeLayout(false);
    155267
     
    166278    private System.Windows.Forms.ComboBox comboBoxGroup;
    167279    private System.Windows.Forms.Label label3;
     280    private System.Windows.Forms.GroupBox regressionGroupBox;
     281    private System.Windows.Forms.ComboBox regressionTypeComboBox;
     282    private System.Windows.Forms.NumericUpDown polynomialRegressionOrderNumericUpDown;
     283    private System.Windows.Forms.Label orderLabel;
     284    private System.Windows.Forms.Label label4;
     285    private System.Windows.Forms.SplitContainer splitContainer1;
    168286  }
    169287}
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs

    r14495 r14514  
    2626using HeuristicLab.Core.Views;
    2727using HeuristicLab.MainForm;
     28using RegressionType = HeuristicLab.Analysis.ScatterPlotDataRowVisualProperties.ScatterPlotDataRowRegressionType;
    2829
    2930namespace HeuristicLab.DataPreprocessing.Views {
     
    4041    public ScatterPlotSingleView() {
    4142      InitializeComponent();
     43
     44      regressionTypeComboBox.DataSource = Enum.GetValues(typeof(RegressionType));
     45      regressionTypeComboBox.SelectedItem = RegressionType.None;
    4246    }
    4347
     
    8892        var groupVariable = (string)comboBoxGroup.SelectedItem;
    8993        ScatterPlot scatterPlot = Content.CreateScatterPlot(xVariable, yVariable, groupVariable);
    90         foreach (var row in scatterPlot.Rows)
     94        var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
     95        int order = (int)polynomialRegressionOrderNumericUpDown.Value;
     96        foreach (var row in scatterPlot.Rows) {
    9197          row.VisualProperties.PointSize = 6;
     98          row.VisualProperties.IsRegressionVisibleInLegend = false;
     99          row.VisualProperties.RegressionType = regressionType;
     100          row.VisualProperties.PolynomialRegressionOrder = order;
     101        }
    92102        var vp = scatterPlot.VisualProperties;
    93103        vp.Title = string.Empty;
     
    144154      UpdateScatterPlot();
    145155    }
     156
     157    #region Regression Line
     158    private void regressionTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     159      var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
     160      polynomialRegressionOrderNumericUpDown.Enabled = regressionType == RegressionType.Polynomial;
     161      UpdateRegressionLine();
     162    }
     163
     164    private void polynomialRegressionOrderNumericUpDown_ValueChanged(object sender, EventArgs e) {
     165      UpdateRegressionLine();
     166    }
     167
     168    private void UpdateRegressionLine() {
     169      var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
     170      int order = (int)polynomialRegressionOrderNumericUpDown.Value;
     171
     172      foreach (var row in scatterPlotControl.Content.Rows) {
     173        row.VisualProperties.IsRegressionVisibleInLegend = false;
     174        row.VisualProperties.RegressionType = regressionType;
     175        row.VisualProperties.PolynomialRegressionOrder = order;
     176      }
     177    }
     178    #endregion
    146179  }
    147180}
     181
Note: See TracChangeset for help on using the changeset viewer.