Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/14 13:37:28 (10 years ago)
Author:
aesterer
Message:

Added coloring feature for line chart

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ChartLogic.cs

    r10811 r10847  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Drawing;
    2425using HeuristicLab.Analysis;
    2526using HeuristicLab.Core;
     
    3536      this.preprocessingData = preprocessingData;
    3637    }
     38
     39    #region IChartLogic Members
    3740
    3841    public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {
     
    9295    }
    9396
     97    public event EventHandler SelectionChanged {
     98      add { preprocessingData.SelectionChanged += value; }
     99      remove { preprocessingData.SelectionChanged -= value; }
     100    }
     101
    94102    public string GetVariableNameByIndex(int index) {
    95103      return preprocessingData.GetVariableName(index);
     
    104112    }
    105113
     114    public List<DataRow> CreateAllSelectedDataRows(DataRowVisualProperties.DataRowChartType chartType) {
     115      List<DataRow> dataRows = new List<DataRow>();
     116      foreach (var name in GetVariableNames()) {
     117        DataRow row = CreateSelectedDataRow(name, chartType);
     118        if(row != null)
     119          dataRows.Add(row);
     120      }
     121      return dataRows;
     122    }
     123
     124    public DataRow CreateSelectedDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) {
     125     
     126      IDictionary<int,IList<int>> selection = preprocessingData.GetSelection();
     127      int variableIndex = preprocessingData.GetColumnIndex(variableName);
     128
     129      if (selection.Keys.Contains(variableIndex))
     130      {
     131        List<int> selectedIndices = new List<int>(selection[variableIndex]);
     132        //need selection with more than 1 value
     133        if(selectedIndices.Count < 2)
     134          return null;
     135
     136        int end = selectedIndices[0];      // indices are provided in reverse order
     137        int start = selectedIndices[selectedIndices.Count-1];
     138
     139        DataRow rowSelect = CreateDataRowRange(variableName, start, end, chartType);
     140        rowSelect.VisualProperties.Color = Color.Green;
     141        return rowSelect;
     142      }
     143      else
     144       return null;
     145    }
     146
     147    #endregion
    106148  }
    107149}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/FilteredPreprocessingData.cs

    r10810 r10847  
    186186    }
    187187
    188     public event EventHandler SelectionChanged;
     188    public event EventHandler SelectionChanged {
     189      add { originalData.SelectionChanged += value; }
     190      remove { originalData.SelectionChanged -= value; }
     191    }
    189192
    190193    #endregion
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingDataTable.cs

    r10803 r10847  
    44using System.Text;
    55using HeuristicLab.Analysis;
     6using HeuristicLab.Collections;
    67using HeuristicLab.Core;
    78
     
    2627        if (selectedRows != null) throw new InvalidOperationException("Rows already set");
    2728        selectedRows = value;
    28         //if (selectedRows != null) RegisterRowsEvents();
     29        //if (selectedRows != null) RegisterSelectedRowEvents();
    2930      }
    3031    }
    3132
    32 
    33 
    3433  }
    3534}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IChartLogic.cs

    r10803 r10847  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Analysis;
     
    3233    event DataPreprocessingChangedEventHandler Changed;
    3334
     35    event EventHandler SelectionChanged;
     36
    3437    ICheckedItemList<StringValue> CreateVariableItemList();
     38
     39    List<DataRow> CreateAllSelectedDataRows(DataRowVisualProperties.DataRowChartType chartType);
     40
     41    DataRow CreateSelectedDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType);
    3542
    3643    DataRow CreateDataRow(string variableName,DataRowVisualProperties.DataRowChartType chartType);
Note: See TracChangeset for help on using the changeset viewer.