Changeset 10851


Ignore:
Timestamp:
05/14/14 14:54:41 (5 years ago)
Author:
aesterer
Message:

Added selection tag in line chart legend

Location:
branches/DataPreprocessing
Files:
2 edited

Legend:

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

    r10847 r10851  
    107107      base.OnContentChanged();
    108108      invisibleSeries.Clear();
    109       //chart.Titles[0].Text = string.Empty;
    110109      chart.ChartAreas[0].AxisX.Title = string.Empty;
    111110      chart.ChartAreas[0].AxisY.Title = string.Empty;
     
    113112      chart.Series.Clear();
    114113      if (Content != null) {
    115         //chart.Titles[0].Text = Content.Name;
     114
    116115        AddDataRows(Content.Rows);
    117116        AddSelectedDataRows(Content.SelectedRows);
     
    150149
    151150    protected virtual void AddSelectedDataRows(IEnumerable<DataRow> rows) {
     151
     152      // add dummy series for selction entry in legend
     153      if (rows.Count() > 0 && chart.Series.FindByName("(Selection)") == null)
     154      {
     155        Series series = new Series("(Selection)");
     156        series.IsVisibleInLegend = true;
     157        series.Color = Color.Green;
     158        series.BorderWidth = 1;
     159        series.BorderDashStyle = ChartDashStyle.Solid;
     160        series.BorderColor = Color.Empty;
     161        series.ChartType = SeriesChartType.FastLine;
     162        chart.Series.Add(series);
     163
     164      }
     165
    152166      foreach (var row in rows) {
    153167        if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Line) {
    154168          row.VisualProperties.IsVisibleInLegend = false;
    155 
     169          row.VisualProperties.Color = Color.Green;
    156170          //add selected to name in order to avoid naming conflict
    157171          var series = new Series(row.Name+"(Selected)");
     
    164178
    165179    protected virtual void RemoveSelectedDataRows(IEnumerable<DataRow> rows) {
     180
     181      //remove selection entry in legend
     182      if (Content.SelectedRows.Count == 0) {
     183        Series series = chart.Series["(Selection)"];
     184        chart.Series.Remove(series);
     185      }
     186
    166187      foreach (var row in rows) {
    167188        Series series = chart.Series[row.Name + "(Selected)"];
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ChartLogic.cs

    r10847 r10851  
    134134          return null;
    135135
    136         int end = selectedIndices[0];      // indices are provided in reverse order
    137         int start = selectedIndices[selectedIndices.Count-1];
     136        selectedIndices.Sort();
     137        int start = selectedIndices[0];     
     138        int end = selectedIndices[selectedIndices.Count-1];
    138139
    139140        DataRow rowSelect = CreateDataRowRange(variableName, start, end, chartType);
    140         rowSelect.VisualProperties.Color = Color.Green;
    141141        return rowSelect;
    142142      }
Note: See TracChangeset for help on using the changeset viewer.