Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/18/17 13:17:00 (7 years ago)
Author:
pfleck
Message:

#2715

  • Added 3 types of histogram aggregation: Overlapping (transparent), SideBySide and Stacked
  • Added a "clear color"-button in the DataRowVisualPropertiesControl to set the color back to the default color palette color.
  • Set the legend ordering to "reversed". Otherwise legend entries of multiple histograms are not ordered according tho the DataRow ordering.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableControl.cs

    r14519 r14582  
    118118      foreach (var row in rows) {
    119119        RegisterDataRowEvents(row);
    120         var series = new Series(row.Name);
     120        var series = new Series(row.Name) {
     121          Tag = row
     122        };
    121123        if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName;
    122124        else series.LegendText = row.Name;
     
    128130      RecalculateAxesScale(chart.ChartAreas[0]);
    129131      UpdateYCursorInterval();
     132      UpdateHistogramTransparency();
    130133    }
    131134
     
    174177          break;
    175178        case DataRowVisualProperties.DataRowChartType.Histogram:
    176           series.ChartType = SeriesChartType.StackedColumn;
     179          bool stacked = row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.Stacked;
     180          series.ChartType = stacked ? SeriesChartType.StackedColumn : SeriesChartType.Column;
     181          bool sideBySide = row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.SideBySide;
     182          series.SetCustomProperty("DrawSideBySide", sideBySide ? "True" : "False");
    177183          series.SetCustomProperty("PointWidth", "1");
    178184          if (!series.Color.IsEmpty && series.Color.GetBrightness() < 0.25)
     
    275281    }
    276282
     283    protected void UpdateHistogramTransparency() {
     284      if (Content.Rows.Any(r => RequiresTransparency(r) && r.VisualProperties.Color.IsEmpty)) {
     285        foreach (var series in chart.Series) // sync colors before applying palette colors
     286          series.Color = ((DataRow)series.Tag).VisualProperties.Color;
     287        chart.ApplyPaletteColors();
     288      }
     289
     290      var numTransparent = Content.Rows.Count(RequiresTransparency);
     291      if (numTransparent <= 1) return;
     292      foreach (var series in chart.Series) {
     293        var row = (DataRow)series.Tag;
     294        if (!RequiresTransparency(row))
     295          continue;
     296        var baseColor = row.VisualProperties.Color;
     297        if (baseColor.IsEmpty) baseColor = series.Color;
     298        series.Color = Color.FromArgb(180, baseColor);
     299      }
     300    }
     301    private bool RequiresTransparency(DataRow row) {
     302      return row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram
     303             && row.VisualProperties.Aggregation == DataRowVisualProperties.DataRowHistogramAggregation.Overlapping;
     304    }
     305
    277306    #region Event Handlers
    278307    #region Content Event Handlers
     
    327356        series.Points.Clear();
    328357        ConfigureSeries(series, row);
    329         FillSeriesWithRowValues(series, row);
    330         RecalculateAxesScale(chart.ChartAreas[0]);
     358        if (!invisibleSeries.Contains(series)) {
     359          FillSeriesWithRowValues(series, row);
     360          RecalculateAxesScale(chart.ChartAreas[0]);
     361          UpdateHistogramTransparency();
     362        }
    331363      }
    332364    }
Note: See TracChangeset for help on using the changeset viewer.