Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14588


Ignore:
Timestamp:
01/19/17 19:15:33 (8 years ago)
Author:
jzenisek
Message:

#2719 updated databar set and view

Location:
branches/HeuristicLab.DatastreamAnalysis
Files:
2 added
9 edited

Legend:

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

    r14547 r14588  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    4849      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
     
    5354      // chart
    5455      //
    55       this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    56                   | System.Windows.Forms.AnchorStyles.Left)
    57                   | System.Windows.Forms.AnchorStyles.Right)));
     56      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     57            | System.Windows.Forms.AnchorStyles.Left)
     58            | System.Windows.Forms.AnchorStyles.Right)));
    5859      chartArea1.Name = "ChartArea1";
    5960      this.chart.ChartAreas.Add(chartArea1);
     
    7475      // DataBarSetView
    7576      //
    76       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    7777      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    7878      this.Controls.Add(this.chart);
     
    8181      ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
    8282      this.ResumeLayout(false);
    83       this.PerformLayout();
     83
    8484    }
    8585    #endregion
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DataBarSetView.cs

    r14547 r14588  
    3232namespace HeuristicLab.DatastreamAnalysis.Views {
    3333  [View("DataBarSet")]
    34   [Content(typeof(DataBarSet), false)]
     34  [Content(typeof(DataBarSet), true)]
    3535  public partial class DataBarSetView : ItemView {
    3636    private bool updateInProgress;
     37    private string seriesName = "Ensembles";
    3738
    3839    public virtual Image ViewImage {
     
    5354      this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
    5455      this.chart.ChartAreas[0].AxisX.Title = "Ensembles";
    55       this.chart.ChartAreas[0].AxisX.Maximum = 0.0;
    56       this.chart.ChartAreas[0].AxisX.Maximum = Content.Bars.Count;
     56      //this.chart.ChartAreas[0].AxisX.Maximum = 0.0;
     57      //this.chart.ChartAreas[0].AxisX.Maximum = (Content != null && Content.Bars != null) ? Content.Bars.Count : 0.0;
    5758      //AddCustomLabelsToAxis(this.chart.ChartAreas[0].AxisX);
    5859
    59       this.chart.ChartAreas[0].AxisY.Title = "Estimated Values";
     60      this.chart.ChartAreas[0].AxisY.Title = "Estimation Quality";
    6061      this.chart.ChartAreas[0].AxisY.IsStartedFromZero = true;
    6162      this.chart.ChartAreas[0].AxisY.Minimum = 0.0;
     
    6970      axis.CustomLabels.Clear();
    7071
     72      var bars = Content.Bars.ToList();
    7173      for(int i = 0; i < Content.Bars.Count; i++) {
    72         var bar = Content.Bars.Keys.ToList()[i].Value;
    7374        CustomLabel barLabel = new CustomLabel();
    74         barLabel.Text = bar;
     75        barLabel.Text = bars[i].Name;
    7576        barLabel.FromPosition = i;
    7677        barLabel.ToPosition = i + 1;
     
    8283      base.RegisterContentEvents();
    8384      Content.BarsPropertyChanged += new EventHandler(Content_BarsChanged);
    84       Content.BarValuesChanged += new EventHandler(Content_BarValuesChanged);
     85      Content.BarValueChanged += new EventHandler(Content_BarValuesChanged);
    8586      Content.ThresholdsPropertyChanged += new EventHandler(Content_ThresholdsChanged);
    8687    }
     
    8990      base.DeregisterContentEvents();
    9091      Content.BarsPropertyChanged -= new EventHandler(Content_BarsChanged);
    91       Content.BarValuesChanged -= new EventHandler(Content_BarValuesChanged);
     92      Content.BarValueChanged -= new EventHandler(Content_BarValuesChanged);
    9293      Content.ThresholdsPropertyChanged -= new EventHandler(Content_ThresholdsChanged);
    9394    }
     
    110111    }
    111112    private void UpdateChart() {
    112       if (updateInProgress) {
     113      if (InvokeRequired) {
    113114        Invoke((Action) UpdateChart);
    114       }
    115 
    116       updateInProgress = true;
    117 
    118       // TODO
    119       // clear the whole chart and redraw everything
    120 
    121 
    122       updateInProgress = false;
     115      } else if(!updateInProgress) {
     116        if (Content == null) return;
     117
     118        updateInProgress = true;
     119
     120        chart.Series.Clear();
     121        Series series = chart.Series.Add(seriesName);
     122        series.IsVisibleInLegend = false;
     123        series.ChartType = SeriesChartType.Column;
     124        int i = 0;
     125        foreach (var bar in Content.Bars) {
     126          series.Points.Add(new DataPoint(i, bar.Value) { AxisLabel = bar.Name, Color = bar.BarColor });
     127          i++;
     128        }
     129
     130        //chart.ChartAreas[0].RecalculateAxesScale();
     131        AddThresholds();
     132        CheckThresholds();
     133
     134        chart.Refresh();
     135        updateInProgress = false;
     136      }
    123137    }
    124138
    125139    private void UpdateChartValues() {
    126       if (updateInProgress) {
    127         Invoke((Action)UpdateChart);
    128       }
    129 
    130       updateInProgress = true;
    131 
    132       // TODO
    133       // simply update the bars' values
    134 
    135       updateInProgress = false;
     140      if (InvokeRequired) {
     141        Invoke((Action) UpdateChartValues);
     142      } else if(!updateInProgress) {
     143        if (Content == null) return;
     144
     145        updateInProgress = true;
     146
     147        //chart.Series[seriesName].Points.Clear();
     148        //foreach (var bar in Content.Bars) {
     149        //  chart.Series[seriesName].Points.AddXY(bar.Name, bar.Value);
     150        //}
     151
     152        var bars = Content.Bars.ToList();
     153
     154        for (int i = 0; i < bars.Count; i++) {
     155          chart.Series[seriesName].Points.ElementAt(i).SetValueY(bars[i].Value);
     156        }
     157
     158        CheckThresholds();
     159        //chart.ChartAreas[0].RecalculateAxesScale();
     160        chart.Refresh();
     161        updateInProgress = false;
     162      }
     163    }
     164
     165    private void CheckThresholds() {
     166      var bars = Content.Bars.ToList();
     167      for (int i = 0; i < bars.Count; i++) {
     168        var bar = bars[i];
     169        if (bar.Value > bar.Threshold) {
     170          chart.Series[seriesName].Points[i].Color = Color.Orange;
     171        } else {
     172          chart.Series[seriesName].Points[i].Color = bar.BarColor;
     173        }
     174      }
     175    }
     176
     177    private void AddThresholdsOld() {
     178      Series series = chart.Series.Add("Thresholds");
     179      series.IsVisibleInLegend = false;
     180      series.ChartType = SeriesChartType.StackedColumn;
     181
     182      int i = 0;
     183      foreach (var bar in Content.Bars) {
     184        //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 });
     186        i++;
     187      }
    136188    }
    137189
    138190    private void AddThresholds() {
    139 
    140       foreach (var threshold in Content.Thresholds) {
    141         // TODO: add threshold as red bold line to each of bars' conlumns
    142       }
    143 
     191      chart.Annotations.Clear();
     192
     193      var bars = Content.Bars.ToList();
     194      for (int i = 0; i < bars.Count; i++) {
     195        HorizontalLineAnnotation annotation = new HorizontalLineAnnotation();
     196        annotation.AllowMoving = false;
     197        annotation.AllowResizing = false;
     198        annotation.LineWidth = 2;
     199        annotation.LineColor = bars[i].ThresholdColor;
     200        annotation.IsInfinitive = false;
     201        annotation.ClipToChartArea = chart.ChartAreas[0].Name;
     202        annotation.AxisX = chart.ChartAreas[0].AxisX;
     203        annotation.AxisY = chart.ChartAreas[0].AxisY;
     204        annotation.Y = bars[i].Threshold;
     205
     206        annotation.Alignment = ContentAlignment.MiddleCenter;
     207        annotation.AnchorX = i;
     208
     209        annotation.X = i - 0.4;
     210        annotation.Width = 52.0 / bars.Count;
     211        annotation.Name = bars[i].Name;
     212        annotation.Tag = bars[i].Name;
     213        annotation.BringToFront();
     214
     215       
     216
     217        chart.Annotations.Add(annotation);
     218      }
    144219    }
    145220
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/HeuristicLab.DatastreamAnalysis.Views.csproj

    r14547 r14588  
    136136  </ItemGroup>
    137137  <ItemGroup>
     138    <EmbeddedResource Include="DataBarSetView.resx">
     139      <DependentUpon>DataBarSetView.cs</DependentUpon>
     140    </EmbeddedResource>
    138141    <EmbeddedResource Include="DatastreamAnalysisOptimizerView.resx">
    139142      <DependentUpon>DatastreamAnalysisOptimizerView.cs</DependentUpon>
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Plugin.cs

    r14547 r14588  
    2323
    2424namespace HeuristicLab.DatastreamAnalysis.Views {
    25   [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14543")]
     25  [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14547")]
    2626  [PluginFile("HeuristicLab.DatastreamAnalysis.Views-3.4.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Properties/AssemblyInfo.cs

    r14547 r14588  
    5454// [assembly: AssemblyVersion("1.0.*")]
    5555[assembly: AssemblyVersion("3.4.0.0")]
    56 [assembly: AssemblyFileVersion("3.4.14.14543")]
     56[assembly: AssemblyFileVersion("3.4.14.14547")]
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisOptimizer.cs

    r14547 r14588  
    158158
    159159    private DataBarSet ResultsQualitiesBars {
    160       get { return (DataBarSet) Results["Ensemble"].Value; }
     160      get { return (DataBarSet) Results["Ensemble Comparison"].Value; }
    161161    }
    162162
     
    165165
    166166      Results.Add(new Result("Sliding Window Movements", new IntValue(0)));
    167       Results.Add(new Result("Qualities", new DataTable("Qualities")));
     167      Results.Add(new Result("Qualities", new DataTable("Pearson R²")));
    168168      Results.Add(new Result("Targets", new DataTable("Targets")));
    169169      Results.Add(new Result("Ensemble Comparison", new DataBarSet("Ensemble Comparison")));
     
    179179
    180180        // qualities (bars)
    181         ResultsQualitiesBars.Bars.Add(new StringValue(ensemble.Name), new DoubleValue(0.0));
     181        ResultsQualitiesBars.Bars.Add(new DataBar(ensemble.Name, 0.9));
    182182      }
    183183    }
     
    435435        var pR2 = error == OnlineCalculatorError.None ? pR * pR : 0.0;
    436436
     437        int replayAmount = Datastream.FitnessPartition.End - replayedIndex;
     438        int replayCount = estimatedValues.Length - replayAmount;
     439
    437440        for (int i = replayedIndex; i < Datastream.FitnessPartition.End; i++) {
    438           ResultsTargets.Rows[ensemble.Name].Values.Add(averageEstimatedValue);
     441          //ResultsTargets.Rows[ensemble.Name].Values.Add(averageEstimatedValue);
     442          ResultsTargets.Rows[ensemble.Name].Values.Add(estimatedValues[replayCount]);
     443          replayCount++;
    439444
    440445          //ResultsQualities.Rows[ensemble.Name + " - " + ResultsQualitiesMSE].Values.Add(mse);
    441446          ResultsQualities.Rows[ensemble.Name + " - " + ResultsQualitiesPR2].Values.Add(pR2);
    442           ResultsQualitiesBars.Bars[new StringValue(ensemble.ItemName)].Value = pR2;
    443           ResultsQualitiesBars.Bars[new StringValue(ensemble.ItemName)] = new DoubleValue(pR2);
    444           //ResultsQualitiesBars.Bars[new StringValue(ensemble.ItemName)]
     447          ResultsQualitiesBars.Bars[ensemble.Name].Value = pR2;
    445448        }
    446449      }
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/HeuristicLab.DatastreamAnalysis.csproj

    r14547 r14588  
    103103  <ItemGroup>
    104104    <Compile Include="AnalysisBase.cs" />
     105    <Compile Include="DataBar.cs" />
    105106    <Compile Include="DataBarSet.cs" />
    106107    <Compile Include="Datastream.cs" />
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Plugin.cs

    r14547 r14588  
    2323
    2424namespace HeuristicLab.DatastreamAnalysis {
    25   [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14543")]
     25  [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14547")]
    2626  [PluginFile("HeuristicLab.DatastreamAnalysis-3.4.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Properties/AssemblyInfo.cs

    r14547 r14588  
    5454// [assembly: AssemblyVersion("1.0.*")]
    5555[assembly: AssemblyVersion("3.4.0.0")]
    56 [assembly: AssemblyFileVersion("3.4.14.14543")]
     56[assembly: AssemblyFileVersion("3.4.14.14547")]
Note: See TracChangeset for help on using the changeset viewer.