Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/21/14 11:43:10 (10 years ago)
Author:
aesterer
Message:

Removed selection from histogram

File:
1 edited

Legend:

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

    r10867 r10868  
    177177    protected virtual void AddSelectedDataRows(IEnumerable<DataRow> rows) {
    178178
    179       // add dummy series for selction entry in legend
    180       if (rows.Count() > 0 && chart.Series.FindByName("(Selection)") == null)
    181       {
    182         Series series = new Series("(Selection)");
    183         series.IsVisibleInLegend = true;
    184         series.Color = Color.Green;
    185         series.BorderWidth = 1;
    186         series.BorderDashStyle = ChartDashStyle.Solid;
    187         series.BorderColor = Color.Empty;
    188         series.ChartType = SeriesChartType.FastLine;
    189         chart.Series.Add(series);
    190 
    191       }
    192 
    193       foreach (var row in rows) {
    194         if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Line) {
     179      // only paint selection for line chart
     180      if (rows.Count() > 0 && rows.ElementAt(0).VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Line)
     181      {
     182        // add dummy series for selction entry in legend
     183        if (rows.Count() > 0 && chart.Series.FindByName("(Selection)") == null) {
     184          Series series = new Series("(Selection)");
     185          series.IsVisibleInLegend = true;
     186          series.Color = Color.Green;
     187          series.BorderWidth = 1;
     188          series.BorderDashStyle = ChartDashStyle.Solid;
     189          series.BorderColor = Color.Empty;
     190          series.ChartType = SeriesChartType.FastLine;
     191          chart.Series.Add(series);
     192        }
     193
     194        foreach (var row in rows) {
    195195          row.VisualProperties.IsVisibleInLegend = false;
    196196          row.VisualProperties.Color = Color.Green;
    197197          //add selected to name in order to avoid naming conflict
    198           var series = new Series(row.Name+"(Selected)");
     198          var series = new Series(row.Name + "(Selected)");
    199199          ConfigureSeries(series, row);
    200200          FillSeriesWithRowValues(series, row);
    201201
    202           if (classification == null)
    203           {
     202          if (classification == null) {
    204203            chart.Series.Add(series);
    205204          }
    206 
    207205        }
    208206      }
     
    211209    protected virtual void RemoveSelectedDataRows(IEnumerable<DataRow> rows) {
    212210
    213       //remove selection entry in legend
    214       if (Content.SelectedRows.Count == 0) {
    215         Series series = chart.Series["(Selection)"];
    216         chart.Series.Remove(series);
    217       }
    218 
    219       foreach (var row in rows) {
    220         Series series = chart.Series[row.Name + "(Selected)"];
    221         chart.Series.Remove(series);
     211      // only remove selection for line chart
     212      if (rows.Count() > 0 && rows.ElementAt(0).VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Line)
     213      {
     214        //remove selection entry in legend
     215        if (Content.SelectedRows.Count == 0) {
     216          Series series = chart.Series["(Selection)"];
     217          chart.Series.Remove(series);
     218        }
     219
     220        foreach (var row in rows) {
     221          Series series = chart.Series[row.Name + "(Selected)"];
     222          chart.Series.Remove(series);
     223        }
    222224      }
    223225    }
Note: See TracChangeset for help on using the changeset viewer.