Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10736


Ignore:
Timestamp:
04/09/14 13:05:38 (10 years ago)
Author:
aesterer
Message:

Update chart when data changed

Location:
branches/DataPreprocessing
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HistogramView.Designer.cs

    r10658 r10736  
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      this.optionsBox = new System.Windows.Forms.GroupBox();
     27      this.allInOneCheckBox = new System.Windows.Forms.CheckBox();
     28      this.optionsBox.SuspendLayout();
    2629      this.SuspendLayout();
     30      //
     31      // optionsBox
     32      //
     33      this.optionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     34      this.optionsBox.Controls.Add(this.allInOneCheckBox);
     35      this.optionsBox.Location = new System.Drawing.Point(4, 263);
     36      this.optionsBox.Name = "optionsBox";
     37      this.optionsBox.Size = new System.Drawing.Size(152, 134);
     38      this.optionsBox.TabIndex = 7;
     39      this.optionsBox.TabStop = false;
     40      this.optionsBox.Text = "Options";
     41      //
     42      // allInOneCheckBox
     43      //
     44      this.allInOneCheckBox.AutoSize = true;
     45      this.allInOneCheckBox.Checked = true;
     46      this.allInOneCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     47      this.allInOneCheckBox.Location = new System.Drawing.Point(6, 19);
     48      this.allInOneCheckBox.Name = "allInOneCheckBox";
     49      this.allInOneCheckBox.Size = new System.Drawing.Size(69, 17);
     50      this.allInOneCheckBox.TabIndex = 0;
     51      this.allInOneCheckBox.Text = "All in one";
     52      this.allInOneCheckBox.UseVisualStyleBackColor = true;
     53      this.allInOneCheckBox.CheckedChanged += new System.EventHandler(this.allInOneCheckBox_CheckedChanged);
    2754      //
    2855      // HistogramView
     
    3057      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    3158      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     59      this.Controls.Add(this.optionsBox);
    3260      this.Name = "HistogramView";
     61      this.Controls.SetChildIndex(this.optionsBox, 0);
     62      this.optionsBox.ResumeLayout(false);
     63      this.optionsBox.PerformLayout();
    3364      this.ResumeLayout(false);
    3465
     
    3768    #endregion
    3869
     70    private System.Windows.Forms.GroupBox optionsBox;
     71    private System.Windows.Forms.CheckBox allInOneCheckBox;
     72
    3973  }
    4074}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HistogramView.cs

    r10712 r10736  
    1 using System.Windows.Forms;
     1using System;
     2using System.Windows.Forms;
    23using HeuristicLab.Analysis;
    34using HeuristicLab.MainForm;
     
    2223    }
    2324
     25    private void allInOneCheckBox_CheckedChanged(object sender, EventArgs e) {
     26      if (allInOneMode == false)
     27        allInOneMode = true;
     28      else
     29        allInOneMode = false;
     30      GenerateChart();
     31    }
     32
    2433  }
    2534}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/LineChartView.Designer.cs

    r10717 r10736  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       this.groupBox1 = new System.Windows.Forms.GroupBox();
    27       this.checkBox1 = new System.Windows.Forms.CheckBox();
    28       this.groupBox1.SuspendLayout();
     26      this.optionsBox = new System.Windows.Forms.GroupBox();
     27      this.allInOneCheckBox = new System.Windows.Forms.CheckBox();
     28      this.optionsBox.SuspendLayout();
    2929      this.SuspendLayout();
    3030      //
    31       // groupBox1
     31      // optionsBox
    3232      //
    33       this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    34       this.groupBox1.Controls.Add(this.checkBox1);
    35       this.groupBox1.Location = new System.Drawing.Point(4, 262);
    36       this.groupBox1.Name = "groupBox1";
    37       this.groupBox1.Size = new System.Drawing.Size(151, 134);
    38       this.groupBox1.TabIndex = 7;
    39       this.groupBox1.TabStop = false;
    40       this.groupBox1.Text = "Options";
     33      this.optionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     34      this.optionsBox.Controls.Add(this.allInOneCheckBox);
     35      this.optionsBox.Location = new System.Drawing.Point(4, 262);
     36      this.optionsBox.Name = "optionsBox";
     37      this.optionsBox.Size = new System.Drawing.Size(151, 134);
     38      this.optionsBox.TabIndex = 7;
     39      this.optionsBox.TabStop = false;
     40      this.optionsBox.Text = "Options";
    4141      //
    42       // checkBox1
     42      // allInOneCheckBox
    4343      //
    44       this.checkBox1.AutoSize = true;
    45       this.checkBox1.Location = new System.Drawing.Point(7, 20);
    46       this.checkBox1.Name = "checkBox1";
    47       this.checkBox1.Size = new System.Drawing.Size(66, 17);
    48       this.checkBox1.TabIndex = 0;
    49       this.checkBox1.Text = "AllInOne";
    50       this.checkBox1.UseVisualStyleBackColor = true;
    51       this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
     44      this.allInOneCheckBox.AutoSize = true;
     45      this.allInOneCheckBox.Checked = true;
     46      this.allInOneCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
     47      this.allInOneCheckBox.Location = new System.Drawing.Point(6, 19);
     48      this.allInOneCheckBox.Name = "allInOneCheckBox";
     49      this.allInOneCheckBox.Size = new System.Drawing.Size(69, 17);
     50      this.allInOneCheckBox.TabIndex = 0;
     51      this.allInOneCheckBox.Text = "All in one";
     52      this.allInOneCheckBox.UseVisualStyleBackColor = true;
     53      this.allInOneCheckBox.CheckedChanged += new System.EventHandler(this.allInOneCheckBox_CheckedChanged);
    5254      //
    5355      // LineChartView
     
    5557      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    5658      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    57       this.Controls.Add(this.groupBox1);
     59      this.Controls.Add(this.optionsBox);
    5860      this.Name = "LineChartView";
    59       this.Controls.SetChildIndex(this.groupBox1, 0);
    60       this.groupBox1.ResumeLayout(false);
    61       this.groupBox1.PerformLayout();
     61      this.Controls.SetChildIndex(this.optionsBox, 0);
     62      this.optionsBox.ResumeLayout(false);
     63      this.optionsBox.PerformLayout();
    6264      this.ResumeLayout(false);
    6365
     
    6668    #endregion
    6769
    68     private System.Windows.Forms.GroupBox groupBox1;
    69     private System.Windows.Forms.CheckBox checkBox1;
     70    private System.Windows.Forms.GroupBox optionsBox;
     71    private System.Windows.Forms.CheckBox allInOneCheckBox;
    7072  }
    7173}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/LineChartView.cs

    r10717 r10736  
    4444    }
    4545
    46     private void checkBox1_CheckedChanged(object sender, EventArgs e) {
     46    private void allInOneCheckBox_CheckedChanged(object sender, EventArgs e) {
    4747      if (allInOneMode == false)
    4848        allInOneMode = true;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingChartView.cs

    r10717 r10736  
    4646    protected DataRowVisualProperties.DataRowChartType chartType;
    4747    protected string chartTitle;
    48     protected bool allInOneMode = true;
     48    protected bool allInOneMode;
    4949
    5050    private const string DEFAULT_CHART_TITLE = "Chart";
     
    5555      chartType = DataRowVisualProperties.DataRowChartType.Line;
    5656      chartTitle = DEFAULT_CHART_TITLE;
     57      allInOneMode = true;
    5758    }
    5859
     
    9798    protected override void RegisterContentEvents() {
    9899      base.RegisterContentEvents();
    99       Content.Changed += Content_Changed;
     100      Content.ChartLogic.Changed += PreprocessingData_Changed;
     101     
    100102    }
    101103
    102104    protected override void DeregisterContentEvents() {
    103105      base.DeregisterContentEvents();
    104       Content.Changed -= Content_Changed;
    105     }
    106 
    107     void Content_Changed(object sender, DataPreprocessingChangedEventArgs e) {
    108       dataTableView.Refresh();
     106      Content.ChartLogic.Changed -= PreprocessingData_Changed;
    109107    }
    110108
     
    116114    private void InitData() {
    117115      variableItemList = logic.CreateVariableItemList();
     116      checkedItemList.Content = variableItemList;
    118117      dataRows = logic.CreateAllDataRows(chartType);
    119118
     
    147146      if (Content != null) {
    148147        logic = Content.ChartLogic;
    149         InitData();
    150         checkedItemList.Content = variableItemList;
    151         GenerateChart();
     148        InitData();       
    152149        variableItemList.CheckedItemsChanged += CheckedItemsChanged;
    153         logic.Changed += PreprocessingData_Changed;
     150        GenerateChart();               
    154151      }
    155152    }
     
    166163        case DataPreprocessingChangedEventType.ChangeColumn:
    167164        case DataPreprocessingChangedEventType.ChangeItem:
    168           //UpdateDataForVariable(logic.GetVariableNameByIndex(e.Column));
    169 
     165          UpdateDataForVariable(logic.GetVariableNameByIndex(e.Column));
    170166          break;
    171167        case DataPreprocessingChangedEventType.DeleteRow:
    172168        case DataPreprocessingChangedEventType.AddRow:
     169        case DataPreprocessingChangedEventType.Any:
     170          InitData();
     171          GenerateChart();
     172         
    173173          break;
    174174      }
     
    179179      dataTable.Rows.Remove(variableName);
    180180      dataTable.Rows.Add(newRow);
    181       DataTable dt = dataTablePerVariable.Find(x => (x.Rows.ItemName == variableName));
    182       dt.Rows.Remove(variableName);
    183       dt.Rows.Add(newRow);
     181      DataTable dt = dataTablePerVariable.Find(x => x.Rows.Find(y => y.Name == variableName) != null);
     182      if (dt != null) {
     183        dt.Rows.Remove(variableName);
     184        dt.Rows.Add(newRow);
     185      }
    184186    }
    185187
     
    210212    protected void GenerateChart() {
    211213
     214      ClearTableLayout(); 
     215
     216      if (allInOneMode) {
     217        GenerateSingleChartLayout();
     218      } else
     219        GenerateMultiChartLayout();
     220    }
     221
     222    private void ClearTableLayout() {
    212223      //Clear out the existing controls
    213224      tableLayoutPanel.Controls.Clear();
     
    217228      tableLayoutPanel.RowStyles.Clear();
    218229      tableLayoutPanel.AutoScroll = false;
    219       tableLayoutPanel.AutoScroll = true;   
    220 
    221       if (allInOneMode) {
    222         GenerateSingleChartLayout();
    223       } else
    224         GenerateMultiChartLayout();
    225     }
     230      tableLayoutPanel.AutoScroll = true;
     231    }   
    226232
    227233    private void GenerateSingleChartLayout() {
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ChartLogic.cs

    r10733 r10736  
    3838    public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {
    3939      IList<double> values = preprocessingData.GetValues<double>(variableName);
     40
     41      //TODO: handle NAN values correctly
     42      // CalculateHistogram in DataTableView fails with NAN values ( Min(), Max() returns NAN)
     43      ReplayNANwithZero(values);
    4044      DataRow row = new DataRow(variableName, "", values);
    4145      row.VisualProperties.ChartType = chartType;
    4246      return row;
    4347    }
     48
     49    private void ReplayNANwithZero(IList<double> values) {
     50      for (int i = 0; i < values.Count; i++) {
     51        if (Double.IsNaN(values[i]))
     52          values[i] = 0;
     53      }
     54    }
     55
     56
    4457
    4558    private IEnumerable<string> GetVariableNames() {
Note: See TracChangeset for help on using the changeset viewer.