Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10979


Ignore:
Timestamp:
06/11/14 13:18:37 (10 years ago)
Author:
psteiner
Message:

datacompleteness view
formating filter percentage

Location:
branches/DataPreprocessing
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab 3.3.sln

    r10978 r10979  
    11
    22Microsoft Visual Studio Solution File, Format Version 12.00
    3 # Visual Studio 2012
     3# Visual Studio 2013
     4VisualStudioVersion = 12.0.30501.0
     5MinimumVisualStudioVersion = 10.0.40219.1
    46Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{96396439-A764-4022-A8D2-BE021449B8D1}"
    57  ProjectSection(SolutionItems) = preProject
     
    19241926    HideSolutionNode = FALSE
    19251927  EndGlobalSection
    1926   GlobalSection(Performance) = preSolution
    1927     HasPerformanceSessions = true
    1928   EndGlobalSection
    19291928EndGlobal
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataCompletenessView.Designer.cs

    r10913 r10979  
    2828      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    2929      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    30       System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
    3130      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    3231      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
     
    3534      // chart
    3635      //
     36      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     37            | System.Windows.Forms.AnchorStyles.Left)
     38            | System.Windows.Forms.AnchorStyles.Right)));
    3739      chartArea1.Name = "ChartArea1";
    3840      this.chart.ChartAreas.Add(chartArea1);
     
    4143      this.chart.Location = new System.Drawing.Point(4, 4);
    4244      this.chart.Name = "chart";
    43       series1.ChartArea = "ChartArea1";
    44       series1.Legend = "Legend1";
    45       series1.Name = "Series1";
    46       this.chart.Series.Add(series1);
    4745      this.chart.Size = new System.Drawing.Size(486, 337);
    4846      this.chart.TabIndex = 0;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataCompletenessView.cs

    r10913 r10979  
    77using HeuristicLab.DataPreprocessing.Implementations;
    88using System.Drawing;
     9using System.Windows.Forms.DataVisualization.Charting;
    910
    1011namespace HeuristicLab.DataPreprocessing.Views {
     
    1516  {
    1617
    17     protected DataRowVisualProperties.DataRowChartType chartType;
    18     protected string chartTitle;
    19 
    20     private const string DEFAULT_CHART_TITLE = "DataCompletenessChart";
    21 
    2218    //list of columns, bool indicates wether the cell is a missing value or not
    2319    private List<List<bool>> matrix = new List<List<bool>>();
     20    //series colors
     21    private static Color colorNonMissingVal = Color.CornflowerBlue;
     22    private static Color colorMissingVal = Color.Orange;
    2423
    2524    public new DataCompletenessChartContent Content
     
    3332    {
    3433      InitializeComponent();
    35       chartType = DataRowVisualProperties.DataRowChartType.Bars;
    36       chartTitle = DEFAULT_CHART_TITLE;
    3734    }
    3835
     
    4239      if (Content != null)
    4340      {
     41        //chart.PrePaint += chart_PrePaint;
     42        //chart.CustomizeLegend += chart_CustomizeLegend;
    4443        InitData();
    4544      }
    4645    }
     46
     47   
     48    /*
     49    void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e)
     50    {
     51      foreach (LegendItem li in e.LegendItems)
     52      {
     53        int label;
     54        int.TryParse(li.Cells[0].ToString(), out label);
     55
     56        li.Cells[0].Text = "Banane";
     57        //li.Cells[0].Text = (label - Content.DataGridLogic.Rows).ToString();
     58      }
     59    }*/
    4760
    4861    private void InitData()
     
    5972      }
    6073      List<List<int>> yValuesPerColumn = ProcessMatrixForCharting(matrix, missingValueIndices);
    61       createSeries(yValuesPerColumn);
    62       //CreateChart();
     74      PrepareChart();
     75      CreateSeries(yValuesPerColumn);
    6376    }
    6477
    65     private void createSeries(List<List<int>> yValuesPerColumn)
     78    private void PrepareChart()
     79    {
     80      chart.Titles.Add("DataCompletenessChart");
     81      chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0;
     82      chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0;
     83      chart.ChartAreas[0].AxisX.IsMarginVisible = false;
     84      chart.ChartAreas[0].AxisY.IsMarginVisible = false;
     85      //custom x axis label
     86      double from = 0.5;
     87      foreach (String columnName in Content.DataGridLogic.ColumnNames)
     88      {
     89        double to = from + 1;
     90        chart.ChartAreas[0].AxisX.CustomLabels.Add(from, to, columnName);
     91        from = to;
     92      }
     93      //custom y axis label
     94      chart.ChartAreas[0].AxisY.IsReversed = true;
     95    }
     96
     97
     98
     99    private void CreateSeries(List<List<int>> yValuesPerColumn)
    66100    {
    67101      //prepare series
    68       int seriesCount = determineSeriesCount(yValuesPerColumn);
     102      int seriesCount = DetermineSeriesCount(yValuesPerColumn);
    69103      for (int i = 0; i < seriesCount; i++)
    70104      {
    71         chart.Series.Add("series"+i);
    72         chart.Series["series"+i].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn;
     105        chart.Series.Add(CreateSeriesName(i));
     106        Series series = chart.Series[CreateSeriesName(i)];
     107        series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedColumn;
     108        series.IsVisibleInLegend = false;
     109        series["PointWidth"] = "1.0";
    73110        if (i % 2 == 0)
    74           chart.Series["series" + i].Color = Color.Blue;
     111        {
     112          if (i == 0) //show legend for non missing values only once
     113            series.IsVisibleInLegend = true;
     114          series.Color = colorNonMissingVal;
     115        }
    75116        else
    76           chart.Series["series" + i].Color = Color.White;
     117        {
     118          if (i == 1) //show legend for missing values only once
     119            series.IsVisibleInLegend = true;
     120          series.Color = colorMissingVal;
     121        }
    77122      }
    78123      //fill series
     
    82127        for (int j = 0; j < seriesCount; j++) {
    83128          if (column.Count - 1 < j) {
    84             chart.Series["series"+j].Points.AddY(0);
     129            chart.Series[CreateSeriesName(j)].Points.AddY(0);
    85130          } else {
    86             chart.Series["series" + j].Points.AddY(column[j]);
     131            chart.Series[CreateSeriesName(j)].Points.AddY(column[j]);
    87132          }
    88133        }
     
    90135    }
    91136
    92     private int determineSeriesCount(List<List<int>> yValuesPerColumn)
     137    private String CreateSeriesName(int index)
     138    {
     139      if (index == 0)
     140        return "non-missing value";
     141      else if (index == 1)
     142        return "missing value";
     143      return "series" + index;
     144    }
     145
     146    #region data_preparation_for_chartseries
     147    private int DetermineSeriesCount(List<List<int>> yValuesPerColumn)
    93148    {
    94149      int highest = 0;
     
    121176        }
    122177        yValues.Add(valueCount);
    123             /*
    124         List<int> yValues = new List<int>();
    125         bool missingChanged = true;
    126         while ()
    127              * */
     178        if (missingState) //handle last missing
     179        {
     180          yValues.Add(0);
     181        }
     182        //yValues.Reverse();
    128183        columnsYValues.Add(yValues);
    129184      }
    130185      return columnsYValues;
    131186    }
    132 
    133     const String missingValue = "Red";
    134     const String existingValue = "DarkBlue";
    135 
    136 
    137     private void CreateChart()
    138     {
    139       object[] temp = new[] { "1", "50" };
    140       object[] temp2 = new[] { "50", "1000" };
    141       chart.Series.Add(missingValue);
    142       chart.Series.Add(existingValue);
    143 
    144       for(int i=0; i < matrix.Count; i++) {
    145         List<bool> column = matrix[i];
    146         for (int j = 0; j < column.Count; j++ )
    147         {
    148           chart.Series[missingValue].Points.AddXY(i, temp);
    149           chart.Series[existingValue].Points.AddXY(i, temp2);
    150           chart.Series[missingValue].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedBar;
    151           chart.Series[existingValue].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.StackedBar;
    152         }
    153       }
    154     }
    155 
    156     /*
    157     private DataRow columnToDataRow(List<bool> column, int i)
    158     {
    159       DataRow row = new DataRow("row"+i);
    160       foreach (bool missing in column) {
    161         row.Values.Add(missing? 1 : 0);
    162       }
    163       return row;
    164     }*/
    165 
     187    #endregion
    166188  }
    167189}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.Designer.cs

    r10933 r10979  
    4242      this.rBtnAnd = new System.Windows.Forms.RadioButton();
    4343      this.groupBox1 = new System.Windows.Forms.GroupBox();
     44      this.label4 = new System.Windows.Forms.Label();
    4445      this.label1 = new System.Windows.Forms.Label();
    4546      this.label2 = new System.Windows.Forms.Label();
    4647      this.label3 = new System.Windows.Forms.Label();
    47       this.label4 = new System.Windows.Forms.Label();
    4848      this.groupBoxFilter.SuspendLayout();
    4949      this.groupBoxFilterInfo.SuspendLayout();
     
    152152      //
    153153      this.applyFilterButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     154      this.applyFilterButton.Cursor = System.Windows.Forms.Cursors.Default;
    154155      this.applyFilterButton.Enabled = false;
    155156      this.applyFilterButton.Location = new System.Drawing.Point(554, 628);
     
    165166      this.rBtnOr.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    166167      this.rBtnOr.AutoSize = true;
     168      this.rBtnOr.Cursor = System.Windows.Forms.Cursors.Default;
    167169      this.rBtnOr.Enabled = false;
    168170      this.rBtnOr.Location = new System.Drawing.Point(60, 634);
     
    178180      this.rBtnAnd.AutoSize = true;
    179181      this.rBtnAnd.Checked = true;
     182      this.rBtnAnd.Cursor = System.Windows.Forms.Cursors.Default;
    180183      this.rBtnAnd.Enabled = false;
    181184      this.rBtnAnd.Location = new System.Drawing.Point(10, 634);
     
    203206      this.groupBox1.Text = "Filter Info";
    204207      //
     208      // label4
     209      //
     210      this.label4.AutoSize = true;
     211      this.label4.Location = new System.Drawing.Point(15, 98);
     212      this.label4.Name = "label4";
     213      this.label4.Size = new System.Drawing.Size(455, 13);
     214      this.label4.TabIndex = 12;
     215      this.label4.Text = "The Apply Filter Button permanently activates the filters. This means unfiltered " +
     216    "rows are deleted.";
     217      //
    205218      // label1
    206219      //
     
    231244      this.label3.TabIndex = 6;
    232245      this.label3.Text = "A filter specifies the data rows which should remain.";
    233       //
    234       // label4
    235       //
    236       this.label4.AutoSize = true;
    237       this.label4.Location = new System.Drawing.Point(15, 98);
    238       this.label4.Name = "label4";
    239       this.label4.Size = new System.Drawing.Size(455, 13);
    240       this.label4.TabIndex = 12;
    241       this.label4.Text = "The Apply Filter Button permanently activates the filters. This means unfiltered " +
    242     "rows are deleted.";
    243246      //
    244247      // FilterView
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/FilterView.cs

    r10933 r10979  
    7272
    7373        tbFiltered.Text = filteredCnt.ToString();
    74         double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / result.Length;
    75         tbPercentage.Text = percentage.ToString() + "%";
     74        double percentage = result.Length == 0 ? 0.0 : filteredCnt * 100 / (double)result.Length;
     75        tbPercentage.Text = String.Format("{0:0.0000}%", percentage);
    7676        tbTotal.Text = result.Length.ToString();
    7777    }
Note: See TracChangeset for help on using the changeset viewer.