Ignore:
Timestamp:
03/02/17 14:10:57 (5 years ago)
Author:
jzenisek
Message:

#2719 implemented ensemble model rating by introducing the new type RatedEnsembleModel; introduced performance indicator calculation in results;

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DataBarSetView.cs

    r14588 r14710  
    119119
    120120        chart.Series.Clear();
     121       
    121122        Series series = chart.Series.Add(seriesName);
    122123        series.IsVisibleInLegend = false;
     
    124125        int i = 0;
    125126        foreach (var bar in Content.Bars) {
    126           series.Points.Add(new DataPoint(i, bar.Value) { AxisLabel = bar.Name, Color = bar.BarColor });
     127          var dp = new DataPoint(i, bar.Value) {
     128            AxisLabel = bar.Name,
     129            ToolTip = bar.Name,
     130            Color = bar.BarColor,
     131            BorderWidth = 5
     132          };
     133          series.Points.Add(dp);
    127134          i++;
    128135        }
     
    154161        for (int i = 0; i < bars.Count; i++) {
    155162          chart.Series[seriesName].Points.ElementAt(i).SetValueY(bars[i].Value);
     163          chart.Series[seriesName].Points.ElementAt(i).ToolTip = bars[i].Name + " = " + bars[i].Value;
    156164        }
    157165
     
    163171    }
    164172
     173    public static Color DefaultColor = Color.FromArgb(65, 140, 240);
     174    public static Color HighlightColor1 = Color.FromArgb(37, 105, 175);
     175    public static Color HighlightColor2 = Color.FromArgb(247, 150, 70);
     176    public static Color HighlightColor3 = Color.FromArgb(228, 108, 10);
     177    //public static Color HighlightColor1 = Color.FromArgb(45, 120, 200);
     178    //public static Color HighlightColor2 = Color.FromArgb(15, 90, 160);
     179    //public static Color HighlightColor3 = Color.FromArgb(10, 60, 110);
    165180    private void CheckThresholds() {
    166181      var bars = Content.Bars.ToList();
     182      var winner =
     183        !bars.Any() ? -1 :
     184        bars
     185        .Select((value, index) => new {Value = value, Index = index})
     186        .Aggregate((a, b) => ((a.Value.Value - a.Value.ThresholdUpperBound) > (b.Value.Value - b.Value.ThresholdUpperBound)) ? a : b)
     187        .Index;
     188
     189      // color bars depending on the threshold boundaries they exceed
    167190      for (int i = 0; i < bars.Count; i++) {
    168191        var bar = bars[i];
    169         if (bar.Value > bar.Threshold) {
    170           chart.Series[seriesName].Points[i].Color = Color.Orange;
     192        if (bar.Value > bar.ThresholdUpperBound) {
     193          chart.Series[seriesName].Points[i].Color = HighlightColor2;
     194          chart.Series[seriesName].Points[i].BorderColor = HighlightColor2;
     195        } else if (bar.Value > bar.ThresholdLowerBound) {
     196          chart.Series[seriesName].Points[i].Color = HighlightColor1;
     197          chart.Series[seriesName].Points[i].BorderColor = HighlightColor1;
    171198        } else {
    172199          chart.Series[seriesName].Points[i].Color = bar.BarColor;
     200          chart.Series[seriesName].Points[i].BorderColor = bar.BarColor;
    173201        }
    174202      }
    175     }
    176 
     203
     204      // color the winner's border
     205      if (winner != -1 && bars[winner].Value > bars[winner].ThresholdUpperBound) {
     206        chart.Series[seriesName].Points[winner].BorderColor = HighlightColor3;
     207      }
     208    }
     209
     210
     211
     212    private void AddThresholds() {
     213      Series series = chart.Series.Add("Thresholds");
     214      series.IsVisibleInLegend = false;
     215      series.ChartType = SeriesChartType.ErrorBar;
     216
     217      int i = 0;
     218      foreach (var bar in Content.Bars) {
     219        string desc = string.Format("{0} - Threshold [{1},{2}]", bar.Name, bar.ThresholdLowerBound,bar.ThresholdUpperBound);
     220        var threshold = new DataPoint(i, new[]
     221              {(bar.ThresholdLowerBound + bar.ThresholdUpperBound)/2, bar.ThresholdLowerBound, bar.ThresholdUpperBound}) {
     222                AxisLabel = desc,
     223                ToolTip = desc,
     224                Color = bar.ThresholdColor,
     225                BorderWidth = 1
     226        };
     227        series.Points.Add(threshold);
     228        i++;
     229      }
     230    }
    177231    private void AddThresholdsOld() {
    178232      Series series = chart.Series.Add("Thresholds");
     
    183237      foreach (var bar in Content.Bars) {
    184238        //series.Points.Add(new DataPoint(i, new [] { bar.Threshold, bar.Threshold + 0.05 }) { AxisLabel = bar.Name, Color = Color.Transparent, BorderWidth = 2, BorderColor = bar.ThresholdColor});
    185         series.Points.Add(new DataPoint(i, new[] { bar.Threshold, bar.Threshold + 0.05 }) { AxisLabel = bar.Name, Color = bar.ThresholdColor });
     239        series.Points.Add(new DataPoint(i, new[] { bar.ThresholdLowerBound, bar.ThresholdUpperBound }) { AxisLabel = bar.Name, Color = bar.ThresholdColor });
    186240        i++;
    187241      }
    188242    }
    189 
    190     private void AddThresholds() {
     243    private void AddThresholdsOld2() {
    191244      chart.Annotations.Clear();
    192245
     
    202255        annotation.AxisX = chart.ChartAreas[0].AxisX;
    203256        annotation.AxisY = chart.ChartAreas[0].AxisY;
    204         annotation.Y = bars[i].Threshold;
     257        annotation.Y = bars[i].ThresholdLowerBound;
    205258
    206259        annotation.Alignment = ContentAlignment.MiddleCenter;
     
    208261
    209262        annotation.X = i - 0.4;
    210         annotation.Width = 52.0 / bars.Count;
     263        annotation.Width = (46 - bars.Count) / bars.Count;
    211264        annotation.Name = bars[i].Name;
    212265        annotation.Tag = bars[i].Name;
Note: See TracChangeset for help on using the changeset viewer.