Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/09/14 13:41:30 (11 years ago)
Author:
aesterer
Message:

Handle add/delete column in chart view

File:
1 edited

Legend:

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

    r10736 r10741  
    6666        } else {
    6767          DataRow row = GetDataRow(variableName);
    68           //row.VisualProperties.Color = GetRandomColor();
    6968          dataTable.Rows.Add(row);
    7069          DataTable d = new DataTable(variableName);
     
    7776        GenerateChart();
    7877
    79     }
    80 
    81     private Color GetRandomColor() {
    82       Random randomGen = new Random();
    83       KnownColor[] names = (KnownColor[])Enum.GetValues(typeof(KnownColor));
    84       KnownColor randomColorName = names[randomGen.Next(names.Length)];
    85       Color randomColor = Color.FromKnownColor(randomColorName);
    86       return randomColor;
    8778    }
    8879
     
    127118        DataTable d = new DataTable(variableName);
    128119        DataRow row = GetDataRow(variableName);
    129         //row.VisualProperties.Color = GetRandomColor();
    130120        d.Rows.Add(row);
    131121        dataTablePerVariable.Add(d);
     
    156146      switch (e.Type) {
    157147        case DataPreprocessingChangedEventType.DeleteColumn:
    158           //RemoveVariable(logic.GetVariableNameByIndex(e.Column));
     148          RemoveVariable(logic.GetVariableNameByIndex(e.Column));
    159149          break;
    160150        case DataPreprocessingChangedEventType.AddColumn:
    161           //AddVariable(logic.GetVariableNameByIndex(e.Column));
     151          AddVariable(logic.GetVariableNameByIndex(e.Column));
    162152          break;
    163153        case DataPreprocessingChangedEventType.ChangeColumn:
     
    169159        case DataPreprocessingChangedEventType.Any:
    170160          InitData();
    171           GenerateChart();
    172          
     161          GenerateChart();         
    173162          break;
    174163      }
     
    188177    // add variable to data table and item list
    189178    private void AddVariable(string name) {
    190       dataTable.Rows.Add(logic.CreateDataRow(name, chartType));
     179      DataRow row = logic.CreateDataRow(name, chartType);
     180      dataTable.Rows.Add(row);
     181      DataTable d = new DataTable(name);
     182      d.Rows.Add(row);
     183      dataTablePerVariable.Add(d);
    191184      variableItemList.Add(new StringValue(name));
     185      if (!allInOneMode)
     186        GenerateChart();
    192187    }
    193188
     
    195190    private void RemoveVariable(string name) {
    196191      dataTable.Rows.Remove(name);
     192      dataTablePerVariable.Remove(dataTablePerVariable.Find(x => (x.Name == name)));
    197193
    198194      StringValue stringValue = FindVariableItemList(name);
    199195      if (stringValue != null)
    200196        variableItemList.Remove(stringValue);
    201 
     197      if (!allInOneMode)
     198        GenerateChart();
    202199    }
    203200
Note: See TracChangeset for help on using the changeset viewer.