Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/11/14 15:06:24 (10 years ago)
Author:
rstoll
Message:
  • removed ChartLogic and

moved logic accordingly to PreprocessingChartContent, ScatterPlotContent
modified views etc. to use IFilteredPreprocessingData instead of ChartLogic

  • reordered code
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs

    r10990 r10992  
    4949        var statisticsLogic = new StatisticsLogic(data, searchLogic);
    5050        var manipulationLogic = new ManipulationLogic(data, searchLogic, statisticsLogic, dataGridLogic);
    51         var chartLogic = new ChartLogic(data);
    5251        //var correlationMatrixLogic = new ChartLogic(data);
    5352        var filterLogic = new FilterLogic(data);
     
    5958          new StatisticsContent(statisticsLogic),
    6059
    61           new LineChartContent(chartLogic),
    62           new HistogramContent(chartLogic),
    63           new ScatterPlotContent(Content),
     60          new LineChartContent(data),
     61          new HistogramContent(data),
     62          new ScatterPlotContent(data),
    6463          new CorrelationMatrixContent(Content),
    6564          new DataCompletenessChartContent(dataGridLogic, searchLogic),
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs

    r10942 r10992  
    1818 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
    1919 */
    20 #endregion 
     20#endregion
    2121using System;
    2222using System.Windows.Forms;
     
    4040      base.OnContentChanged();
    4141      if (Content != null) {
    42         logic = Content.ChartLogic;
    4342
    4443        classifierComboBox.Items.Clear();
    4544        classifierComboBox.Items.Add("None");
    4645
    47         foreach (string var in logic.GetVariableNamesForHistogramClassification()) {
     46        foreach (string var in Content.GetVariableNamesForHistogramClassification()) {
    4847          classifierComboBox.Items.Add(var);
    4948        }
     
    6665
    6766      if (classifierComboBox.SelectedIndex != 0) {
    68         Classification = logic.GetVariableValues(classifierComboBox.SelectedItem.ToString());
     67        int columndIndex = Content.PreprocessingData.GetColumnIndex(classifierComboBox.SelectedItem.ToString());
     68        Classification = Content.PreprocessingData.GetValues<double>(columndIndex);
    6969      } else {
    7070        Classification = null;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r10987 r10992  
    2424using System.Windows.Forms;
    2525using HeuristicLab.Analysis;
    26 using HeuristicLab.Analysis.Views;
    2726using HeuristicLab.Collections;
    28 using HeuristicLab.Core;
    2927using HeuristicLab.Core.Views;
    3028using HeuristicLab.Data;
     
    4543    protected DataRowVisualProperties.DataRowChartType chartType;
    4644    protected string chartTitle;
    47     protected IChartLogic logic;
    4845
    4946    private const string DEFAULT_CHART_TITLE = "Chart";
    5047    private const int FIXED_CHART_SIZE = 300;
    51     private const int MAX_TABLE_AUTO_SIZE_ROWS = 3;
     48    private const int MAX_TABLE_ROWS = 3;
    5249
    5350    public IEnumerable<double> Classification { get; set; }
     
    7067          dataTable.SelectedRows.Remove(variableName);
    7168          dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == variableName)));
    72         //variable isnt't displayed -> add
     69          //variable isnt't displayed -> add
    7370        } else {
    7471          DataRow row = GetDataRow(variableName);
     
    8178
    8279          //update selection
    83           if (selectedRow != null)
    84           {
     80          if (selectedRow != null) {
    8581            dataTable.SelectedRows.Add(selectedRow);
    8682            pdt.SelectedRows.Add(selectedRow);
     83          }
    8784        }
    88       }
    8985      }
    9086
     
    106102    protected override void RegisterContentEvents() {
    107103      base.RegisterContentEvents();
    108       Content.ChartLogic.Changed += PreprocessingData_Changed;
    109       Content.ChartLogic.SelectionChanged += PreprocessingData_SelctionChanged;
     104      Content.PreprocessingData.Changed += PreprocessingData_Changed;
     105      Content.PreprocessingData.SelectionChanged += PreprocessingData_SelctionChanged;
    110106
    111107    }
     
    113109    protected override void DeregisterContentEvents() {
    114110      base.DeregisterContentEvents();
    115       Content.ChartLogic.Changed -= PreprocessingData_Changed;
    116       Content.ChartLogic.SelectionChanged -= PreprocessingData_SelctionChanged;
     111      Content.PreprocessingData.Changed -= PreprocessingData_Changed;
     112      Content.PreprocessingData.SelectionChanged -= PreprocessingData_SelctionChanged;
    117113    }
    118114
     
    123119
    124120    private void InitData() {
    125       if (Content.VariableItemList == null)
    126       {
    127         Content.VariableItemList = logic.CreateVariableItemList();
     121      if (Content.VariableItemList == null) {
     122        Content.VariableItemList = Content.CreateVariableItemList();
    128123      }
    129124      checkedItemList.Content = Content.VariableItemList;
    130125
    131126      //Create data tables and data rows
    132       dataRows = logic.CreateAllDataRows(chartType);
     127      dataRows = Content.CreateAllDataRows(chartType);
    133128      dataTable = new PreprocessingDataTable(chartTitle);
    134129      dataTablePerVariable = new List<PreprocessingDataTable>();
    135130
    136131      //add data rows to data tables according to checked item list
    137       foreach (var checkedItem in Content.VariableItemList.CheckedItems)
    138       {
     132      foreach (var checkedItem in Content.VariableItemList.CheckedItems) {
    139133        string variableName = Content.VariableItemList[checkedItem.Index].Value;
    140134        PreprocessingDataTable d = new PreprocessingDataTable(variableName);
     
    155149
    156150      //update data table selection
    157       selectedDataRows = logic.CreateAllSelectedDataRows(chartType);
     151      selectedDataRows = Content.CreateAllSelectedDataRows(chartType);
    158152      dataTable.SelectedRows.Clear();
    159153      dataTable.SelectedRows.AddRange(selectedDataRows);
     
    188182      base.OnContentChanged();
    189183      if (Content != null) {
    190         logic = Content.ChartLogic;
    191184        InitData();
    192185        Content.VariableItemList.CheckedItemsChanged += CheckedItemsChanged;
     
    199192      switch (e.Type) {
    200193        case DataPreprocessingChangedEventType.DeleteColumn:
    201           RemoveVariable(logic.GetVariableNameByIndex(e.Column));
     194          RemoveVariable(Content.PreprocessingData.GetVariableName(e.Column));
    202195          break;
    203196        case DataPreprocessingChangedEventType.AddColumn:
    204           AddVariable(logic.GetVariableNameByIndex(e.Column));
     197          AddVariable(Content.PreprocessingData.GetVariableName(e.Column));
    205198          break;
    206199        case DataPreprocessingChangedEventType.ChangeColumn:
    207200        case DataPreprocessingChangedEventType.ChangeItem:
    208           UpdateDataForVariable(logic.GetVariableNameByIndex(e.Column));
     201          UpdateDataForVariable(Content.PreprocessingData.GetVariableName(e.Column));
    209202          break;
    210203        case DataPreprocessingChangedEventType.DeleteRow:
     
    212205        case DataPreprocessingChangedEventType.Any:
    213206        default:
    214            //TODO: test with transform
     207          //TODO: test with transform
    215208          InitData();
    216209          GenerateChart();
     
    224217
    225218    private void UpdateDataForVariable(string variableName) {
    226       DataRow newRow = logic.CreateDataRow(variableName, chartType);
     219      DataRow newRow = Content.CreateDataRow(variableName, chartType);
    227220      dataTable.Rows.Remove(variableName);
    228221      dataTable.Rows.Add(newRow);
     
    236229    // add variable to data table and item list
    237230    private void AddVariable(string name) {
    238       DataRow row = logic.CreateDataRow(name, chartType);
     231      DataRow row = Content.CreateDataRow(name, chartType);
    239232      dataTable.Rows.Add(row);
    240233      PreprocessingDataTable d = new PreprocessingDataTable(name);
     
    259252
    260253    private StringValue FindVariableItemList(string name) {
    261       foreach (StringValue stringValue in Content.VariableItemList)
    262       {
     254      foreach (StringValue stringValue in Content.VariableItemList) {
    263255        if (stringValue.Value == name)
    264256          return stringValue;
     
    270262
    271263      ClearTableLayout();
    272       if (Content.AllInOneMode)
    273       {
     264      if (Content.AllInOneMode) {
    274265        GenerateSingleChartLayout();
    275266      } else
     
    328319      int columns = GetNrOfMultiChartColumns(checkedItemsCnt);
    329320      int rows = GetNrOfMultiChartRows(checkedItemsCnt, columns);
    330       tableLayoutPanel.VerticalScroll.Enabled = true;
    331      
     321
    332322      tableLayoutPanel.ColumnCount = columns;
    333323      tableLayoutPanel.RowCount = rows;
     
    336326      for (int x = 0; x < columns; x++) {
    337327
    338         if (rows <= MAX_TABLE_AUTO_SIZE_ROWS)
     328        if (rows <= MAX_TABLE_ROWS)
    339329          tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / columns));
    340330        else
     
    345335          if (x == 0) {
    346336            // fixed chart size when there are more than 3 tables
    347             if (rows > MAX_TABLE_AUTO_SIZE_ROWS)
     337            if (rows > MAX_TABLE_ROWS)
    348338              tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, FIXED_CHART_SIZE));
    349339            else
     
    354344          PreprocessingDataTable d = enumerator.Current;
    355345          AddDataTableToTableLayout(d, x, y);
    356          
     346
    357347        }
    358348      }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs

    r10987 r10992  
    11using System;
    22using System.Collections.Generic;
    3 using System.ComponentModel;
    43using System.Drawing;
    54using System.Linq;
    6 using System.Text;
    75using System.Windows.Forms;
    86using HeuristicLab.Analysis;
    9 using HeuristicLab.Analysis.Views;
    10 using HeuristicLab.Collections;
    117using HeuristicLab.Common;
    12 using HeuristicLab.Core;
    138using HeuristicLab.Core.Views;
    14 using HeuristicLab.Data;
    159using HeuristicLab.DataPreprocessing.Implementations;
    1610using HeuristicLab.MainForm;
     
    4741    private void addHeaderToTableLayoutPanels() {
    4842
    49       List<string> variables = Content.GetVariableNames().ToList();
     43      List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();
    5044
    5145      for (int i = 1; i < variables.Count + 1; i++) {
     
    6660    }
    6761
    68     private void GenerateMultiLayout()
    69     {
    70       List<string> variables = Content.GetVariableNames().ToList();
     62    private void GenerateMultiLayout() {
     63      List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();
    7164
    7265      tableLayoutPanel.Controls.Clear();
     
    7669
    7770      //Set row and column count
    78       tableLayoutPanel.ColumnCount = variables.Count+1;
    79       tableLayoutPanel.RowCount = variables.Count+1;
     71      tableLayoutPanel.ColumnCount = variables.Count + 1;
     72      tableLayoutPanel.RowCount = variables.Count + 1;
    8073
    8174      tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, HEADER_WIDTH));
    8275      tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, HEADER_HEIGHT));
    8376      // set column and row layout
    84       for (int x = 0; x < variables.Count; x++)
    85       {
     77      for (int x = 0; x < variables.Count; x++) {
    8678        // auto size
    8779        if (variables.Count <= MAX_AUTO_SIZE_ELEMENTS) {
    8880          tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, (tableLayoutPanel.Width - HEADER_WIDTH) / variables.Count));
    8981          tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, (tableLayoutPanel.Height - HEADER_HEIGHT) / variables.Count));
    90         } 
    91         // fixed size
     82        }
     83          // fixed size
    9284        else {
    9385          tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, FIXED_CHART_WIDTH));
     
    9890      addHeaderToTableLayoutPanels();
    9991      addChartsToTableLayoutPanel();
    100  
     92
    10193    }
    10294
    10395    private void addChartsToTableLayoutPanel() {
    10496
    105       List<string> variables = Content.GetVariableNames().ToList();
     97      List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();
    10698
    10799      //set scatter plots and histograms
     
    119111            tableLayoutPanel.Controls.Add(pcv, y, x);
    120112          }
    121           //scatter plot
     113            //scatter plot
    122114          else {
    123115            ScatterPlot scatterPlot = Content.CreateScatterPlot(variables[x - 1], variables[y - 1]);
     
    147139      // only one data row should be in scatter plot
    148140      if (scatterPlot.Rows.Count == 1) {
    149         string[] variables = scatterPlot.Rows.ElementAt(0).Name.Split(new string[]{" - "},StringSplitOptions.None); // extract variable names from string
     141        string[] variables = scatterPlot.Rows.ElementAt(0).Name.Split(new string[] { " - " }, StringSplitOptions.None); // extract variable names from string
    150142        scatterContent.SelectedXVariable = variables[0];
    151143        scatterContent.SelectedYVariable = variables[1];
     
    161153
    162154        // set only variable name checked
    163         foreach(var checkedItem in histoContent.VariableItemList)
    164         {
    165           if(checkedItem.Value == variableName)
    166             histoContent.VariableItemList.SetItemCheckedState(checkedItem,true);
     155        foreach (var checkedItem in histoContent.VariableItemList) {
     156          if (checkedItem.Value == variableName)
     157            histoContent.VariableItemList.SetItemCheckedState(checkedItem, true);
    167158          else
    168             histoContent.VariableItemList.SetItemCheckedState(checkedItem,false);
    169            
     159            histoContent.VariableItemList.SetItemCheckedState(checkedItem, false);
     160
    170161        }
    171162      }
     
    174165    //open histogram in new tab with new content when double clicked
    175166    private void HistogramDoubleClick(object sender, EventArgs e) {
    176       //PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender;
    177       //HistogramContent histoContent = new HistogramContent(Content,);  // create new content     
    178       //histoContent.VariableItemList = logic.CreateVariableItemList();
    179       //PreprocessingDataTable dataTable = pcv.Content;
    180       //setVariableItemListFromDataTable(histoContent, dataTable);
     167      PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender;
     168      HistogramContent histoContent = new HistogramContent(Content.PreprocessingData);  // create new content     
     169      histoContent.VariableItemList = Content.CreateVariableItemList();
     170      PreprocessingDataTable dataTable = pcv.Content;
     171      setVariableItemListFromDataTable(histoContent, dataTable);
    181172
    182       //MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView));  // open in new tab
     173      MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView));  // open in new tab
    183174    }
    184    
     175
    185176
    186177  }
    187178
    188  
     179
    189180}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs

    r10987 r10992  
    11using System;
    22using System.Collections.Generic;
    3 using System.ComponentModel;
    4 using System.Drawing;
    5 using System.Data;
    63using System.Linq;
    7 using System.Text;
    84using System.Windows.Forms;
    95using HeuristicLab.Analysis;
    10 using HeuristicLab.Analysis.Views;
    11 using HeuristicLab.Collections;
    12 using HeuristicLab.Core;
    136using HeuristicLab.Core.Views;
    14 using HeuristicLab.Data;
    15 using HeuristicLab.DataPreprocessing.Implementations;
    167using HeuristicLab.MainForm;
    178
     
    3324    public void InitData() {
    3425
    35       IEnumerable<string> variables = Content.GetVariableNames();
     26      IEnumerable<string> variables = Content.PreprocessingData.GetDoubleVariableNames();
    3627
    3728      // add variables to combo boxes
     
    8071  }
    8172
    82  
     73
    8374}
Note: See TracChangeset for help on using the changeset viewer.