Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10915


Ignore:
Timestamp:
05/28/14 15:31:47 (10 years ago)
Author:
aesterer
Message:

Splitted scatter plot view in single and multi view

Location:
branches/DataPreprocessing
Files:
8 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj

    r10908 r10915  
    8888      <DependentUpon>ComparisonFilterView.cs</DependentUpon>
    8989    </Compile>
     90    <Compile Include="SingleScatterPlotView.cs">
     91      <SubType>UserControl</SubType>
     92    </Compile>
     93    <Compile Include="SingleScatterPlotView.Designer.cs">
     94      <DependentUpon>SingleScatterPlotView.cs</DependentUpon>
     95    </Compile>
    9096    <Compile Include="DataCompletenessView.cs">
    9197      <SubType>UserControl</SubType>
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/MultiScatterPlotView.Designer.cs

    r10882 r10915  
    2424    /// </summary>
    2525    private void InitializeComponent() {
    26       this.scatterPlotView = new HeuristicLab.DataPreprocessing.Views.PreprocessingScatterPlotView();
    27       this.groupBox1 = new System.Windows.Forms.GroupBox();
    28       this.label2 = new System.Windows.Forms.Label();
    29       this.label1 = new System.Windows.Forms.Label();
    30       this.comboBoxYVariable = new System.Windows.Forms.ComboBox();
    31       this.comboBoxXVariable = new System.Windows.Forms.ComboBox();
    32       this.groupBox1.SuspendLayout();
     26      this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
    3327      this.SuspendLayout();
    3428      //
    35       // scatterPlotView
     29      // tableLayoutPanel
    3630      //
    37       this.scatterPlotView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     31      this.tableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    3832            | System.Windows.Forms.AnchorStyles.Left)
    3933            | System.Windows.Forms.AnchorStyles.Right)));
    40       this.scatterPlotView.Caption = "ScatterPlot View";
    41       this.scatterPlotView.Content = null;
    42       this.scatterPlotView.Location = new System.Drawing.Point(188, 0);
    43       this.scatterPlotView.Name = "scatterPlotView";
    44       this.scatterPlotView.ReadOnly = false;
    45       this.scatterPlotView.Size = new System.Drawing.Size(670, 512);
    46       this.scatterPlotView.TabIndex = 0;
     34      this.tableLayoutPanel.AutoScroll = true;
     35      this.tableLayoutPanel.ColumnCount = 1;
     36      this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
     37      this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
     38      this.tableLayoutPanel.Location = new System.Drawing.Point(3, 3);
     39      this.tableLayoutPanel.Name = "tableLayoutPanel";
     40      this.tableLayoutPanel.RowCount = 1;
     41      this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
     42      this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 514F));
     43      this.tableLayoutPanel.Size = new System.Drawing.Size(860, 514);
     44      this.tableLayoutPanel.TabIndex = 1;
    4745      //
    48       // groupBox1
    49       //
    50       this.groupBox1.Controls.Add(this.label2);
    51       this.groupBox1.Controls.Add(this.label1);
    52       this.groupBox1.Controls.Add(this.comboBoxYVariable);
    53       this.groupBox1.Controls.Add(this.comboBoxXVariable);
    54       this.groupBox1.Location = new System.Drawing.Point(3, 3);
    55       this.groupBox1.Name = "groupBox1";
    56       this.groupBox1.Size = new System.Drawing.Size(179, 157);
    57       this.groupBox1.TabIndex = 1;
    58       this.groupBox1.TabStop = false;
    59       this.groupBox1.Text = "Options";
    60       //
    61       // label2
    62       //
    63       this.label2.AutoSize = true;
    64       this.label2.Location = new System.Drawing.Point(17, 80);
    65       this.label2.Name = "label2";
    66       this.label2.Size = new System.Drawing.Size(55, 13);
    67       this.label2.TabIndex = 3;
    68       this.label2.Text = "Y Variable";
    69       //
    70       // label1
    71       //
    72       this.label1.AutoSize = true;
    73       this.label1.Location = new System.Drawing.Point(17, 25);
    74       this.label1.Name = "label1";
    75       this.label1.Size = new System.Drawing.Size(55, 13);
    76       this.label1.TabIndex = 2;
    77       this.label1.Text = "X Variable";
    78       //
    79       // comboBoxYVariable
    80       //
    81       this.comboBoxYVariable.FormattingEnabled = true;
    82       this.comboBoxYVariable.Location = new System.Drawing.Point(20, 96);
    83       this.comboBoxYVariable.Name = "comboBoxYVariable";
    84       this.comboBoxYVariable.Size = new System.Drawing.Size(121, 21);
    85       this.comboBoxYVariable.TabIndex = 1;
    86       this.comboBoxYVariable.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
    87       //
    88       // comboBoxXVariable
    89       //
    90       this.comboBoxXVariable.FormattingEnabled = true;
    91       this.comboBoxXVariable.Location = new System.Drawing.Point(20, 41);
    92       this.comboBoxXVariable.Name = "comboBoxXVariable";
    93       this.comboBoxXVariable.Size = new System.Drawing.Size(121, 21);
    94       this.comboBoxXVariable.TabIndex = 0;
    95       this.comboBoxXVariable.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
    96       //
    97       // PreprocessingScatterPlotView
     46      // MultiScatterPlotView
    9847      //
    9948      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    10049      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    101       this.Controls.Add(this.groupBox1);
    102       this.Controls.Add(this.scatterPlotView);
    103       this.Name = "PreprocessingScatterPlotView";
     50      this.Controls.Add(this.tableLayoutPanel);
     51      this.Name = "MultiScatterPlotView";
    10452      this.Size = new System.Drawing.Size(863, 517);
    105       this.groupBox1.ResumeLayout(false);
    106       this.groupBox1.PerformLayout();
    10753      this.ResumeLayout(false);
    10854
     
    11157    #endregion
    11258
    113     private HeuristicLab.DataPreprocessing.Views.PreprocessingScatterPlotView scatterPlotView;
    114     private System.Windows.Forms.GroupBox groupBox1;
    115     private System.Windows.Forms.Label label2;
    116     private System.Windows.Forms.Label label1;
    117     private System.Windows.Forms.ComboBox comboBoxYVariable;
    118     private System.Windows.Forms.ComboBox comboBoxXVariable;
     59    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
     60
    11961  }
    12062}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/MultiScatterPlotView.cs

    r10882 r10915  
    33using System.ComponentModel;
    44using System.Drawing;
    5 using System.Data;
    65using System.Linq;
    76using System.Text;
     
    1817namespace HeuristicLab.DataPreprocessing.Views {
    1918
    20   [View("Scatter Plot View")]
    21   [Content(typeof(ScatterPlotContent), false)]
     19  [View("Multi Scatter Plot View")]
     20  [Content(typeof(ScatterPlotContent), true)]
    2221  public partial class MultiScatterPlotView : ItemView {
    2322
    2423    private IChartLogic logic;
     24    private List<string> variables;
    2525
    2626    public MultiScatterPlotView() {
     
    3535    public void InitData() {
    3636
    37       IEnumerable<string> variables = logic.GetVariableNames();
    38       comboBoxXVariable.Items.Clear();
    39       comboBoxYVariable.Items.Clear();
    40 
    41       comboBoxXVariable.Items.AddRange(variables.ToArray());
    42       comboBoxYVariable.Items.AddRange(variables.ToArray());
    43 
    44       if (variables.Count() >= 2) {
    45         comboBoxXVariable.SelectedIndex = 0;
    46         comboBoxYVariable.SelectedIndex = 1;
    47         UpdateScatterPlot();
    48        
    49       }
     37      variables = new List<string>(logic.GetVariableNames());
    5038
    5139    }
     
    5644        logic = Content.ChartLogic;
    5745        InitData();
     46        GenerateMultiLayout();
    5847      }
    5948    }
    6049
    61     private void comboBox_SelectedIndexChanged(object sender, EventArgs e) {
    62       UpdateScatterPlot();
     50    private void GenerateMultiLayout()
     51    {
     52      tableLayoutPanel.Controls.Clear();
     53      //Clear out the existing row and column styles
     54      tableLayoutPanel.ColumnStyles.Clear();
     55      tableLayoutPanel.RowStyles.Clear();
     56
     57      //Set row and column count
     58      tableLayoutPanel.ColumnCount = variables.Count+1;
     59      tableLayoutPanel.RowCount = variables.Count+1;
     60
     61      int headerSize = 50;
     62      int maxAutoSizeElements = 6;
     63      int fixedElementSize = 200;
     64
     65      tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, headerSize));
     66      tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, headerSize));
     67      // set column and row layout
     68      for (int x = 0; x < variables.Count; x++)
     69      {
     70        // auto size
     71        if (variables.Count <= maxAutoSizeElements) {
     72          tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, (tableLayoutPanel.Width - headerSize) / variables.Count));
     73          tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, (tableLayoutPanel.Height - headerSize) / variables.Count));
     74        }
     75        // fixed size
     76        else {
     77          tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, fixedElementSize));
     78          tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, fixedElementSize));
     79        }
     80      }
     81
     82      // set variable header elements
     83      for (int i = 1; i < variables.Count +1; i++)
     84      {
     85         Button b1 = new Button();
     86         b1.Text = variables[i-1];
     87         b1.Dock = DockStyle.Fill;
     88         tableLayoutPanel.Controls.Add(b1,0,i);
     89         Button b2 = new Button();
     90         b2.Text = variables[i - 1];
     91         b2.Dock = DockStyle.Fill;
     92         tableLayoutPanel.Controls.Add(b2, i, 0);
     93      }
     94
     95      //set scatter plots and histograms
     96      for (int x = 1; x < variables.Count + 1; x++)
     97      {
     98
     99        for (int y = 1; y < variables.Count + 1; y++)
     100        {
     101          // use historgram if x variable equals y variable
     102          if (x == y) {
     103            PreprocessingDataTable dataTable = new PreprocessingDataTable();
     104            DataRow dataRow = logic.CreateDataRow(variables[x - 1], DataRowVisualProperties.DataRowChartType.Histogram);
     105            dataTable.Rows.Add(dataRow);
     106            PreprocessingDataTableView pcv = new PreprocessingDataTableView();
     107            pcv.DoubleClick += tableLayoutElementDoubleClick;
     108            pcv.Content = dataTable;
     109            tableLayoutPanel.Controls.Add(pcv, y, x);
     110          }
     111          //scatter plot
     112          else {   
     113            ScatterPlot scatterPlot = logic.CreateScatterPlot(variables[x - 1], variables[y-1]);   
     114            PreprocessingScatterPlotView pspv = new PreprocessingScatterPlotView();
     115            pspv.DoubleClick += tableLayoutElementDoubleClick;
     116            pspv.Content = scatterPlot;
     117            pspv.Dock = DockStyle.Fill;
     118            tableLayoutPanel.Controls.Add(pspv, y, x);
     119          }
     120        }
     121      }
    63122    }
    64123
    65     private void UpdateScatterPlot() {
    66       if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null) {
    67         ScatterPlot scatterPlot = logic.CreateScatterPlot("ScatterPlot", (string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem);
    68         scatterPlotView.Content = scatterPlot;
    69       }
     124    private void tableLayoutElementDoubleClick(object sender, EventArgs e) {
     125
     126       //histogram clicked
     127       if(sender.GetType() == typeof(PreprocessingDataTableView))
     128       {
     129         PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender;
     130         //ScatterPlotContent spc = new ScatterPlotContent(
     131         
     132       }
     133       // scatter plot clicked
     134       else if (sender.GetType() == typeof(PreprocessingScatterPlotView)) {
     135         PreprocessingScatterPlotView pspv = (PreprocessingScatterPlotView)sender;
     136         MainFormManager.MainForm.ShowContent(this.Content, typeof(SingleScatterPlotView));
     137       }
     138
     139       
    70140    }
     141   
    71142
    72143  }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingScatterPlotView.Designer.cs

    r10882 r10915  
    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();
     
    5556      // chart
    5657      //
    57       this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    58                   | System.Windows.Forms.AnchorStyles.Left)
    59                   | System.Windows.Forms.AnchorStyles.Right)));
     58      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     59            | System.Windows.Forms.AnchorStyles.Left)
     60            | System.Windows.Forms.AnchorStyles.Right)));
    6061      this.chart.BorderlineColor = System.Drawing.Color.Black;
    6162      this.chart.BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid;
     
    7172      legend1.Name = "Default";
    7273      this.chart.Legends.Add(legend1);
    73       this.chart.Location = new System.Drawing.Point(0, 26);
     74      this.chart.Location = new System.Drawing.Point(0, 3);
    7475      this.chart.Name = "chart";
    7576      series1.ChartArea = "Default";
     
    7778      series1.Name = "Default";
    7879      this.chart.Series.Add(series1);
    79       this.chart.Size = new System.Drawing.Size(359, 248);
     80      this.chart.Size = new System.Drawing.Size(359, 271);
    8081      this.chart.TabIndex = 3;
    8182      this.chart.Text = "chart";
     
    8384      title1.Name = "Default";
    8485      title1.Text = "Title";
     86      title1.Visible = false;
    8587      this.chart.Titles.Add(title1);
    8688      this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend);
     
    8890      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
    8991      //
    90       // ScatterPlotView
     92      // PreprocessingScatterPlotView
    9193      //
    92       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    9394      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    9495      this.Controls.Add(this.chart);
    95       this.Name = "ScatterPlotView";
     96      this.Name = "PreprocessingScatterPlotView";
    9697      this.Size = new System.Drawing.Size(359, 274);
    97       this.Controls.SetChildIndex(this.chart, 0);
    9898      ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
    9999      this.ResumeLayout(false);
    100       this.PerformLayout();
    101100
    102101    }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/PreprocessingScatterPlotView.cs

    r10882 r10915  
    9696      base.OnContentChanged();
    9797      invisibleSeries.Clear();
    98       chart.Titles[0].Text = string.Empty;
    9998      chart.ChartAreas[0].AxisX.Title = string.Empty;
    10099      chart.ChartAreas[0].AxisY.Title = string.Empty;
    101100      chart.Series.Clear();
    102101      if (Content != null) {
    103         chart.Titles[0].Text = Content.Name;
    104102        AddScatterPlotDataRows(Content.Rows);
    105103        ConfigureChartArea(chart.ChartAreas[0]);
     
    178176
    179177    private void ConfigureChartArea(ChartArea area) {
    180       if (Content.VisualProperties.TitleFont != null) chart.Titles[0].Font = Content.VisualProperties.TitleFont;
    181       if (!Content.VisualProperties.TitleColor.IsEmpty) chart.Titles[0].ForeColor = Content.VisualProperties.TitleColor;
    182       chart.Titles[0].Text = Content.VisualProperties.Title;
    183178
    184179      if (Content.VisualProperties.AxisTitleFont != null) area.AxisX.TitleFont = Content.VisualProperties.AxisTitleFont;
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/SingleScatterPlotView.Designer.cs

    r10897 r10915  
    11namespace HeuristicLab.DataPreprocessing.Views {
    2   partial class MultiScatterPlotView {
     2  partial class SingleScatterPlotView {
    33    /// <summary>
    44    /// Required designer variable.
     
    4040      this.scatterPlotView.Caption = "ScatterPlot View";
    4141      this.scatterPlotView.Content = null;
    42       this.scatterPlotView.Location = new System.Drawing.Point(188, 0);
     42      this.scatterPlotView.Location = new System.Drawing.Point(169, 3);
    4343      this.scatterPlotView.Name = "scatterPlotView";
    4444      this.scatterPlotView.ReadOnly = false;
    45       this.scatterPlotView.Size = new System.Drawing.Size(670, 512);
     45      this.scatterPlotView.Size = new System.Drawing.Size(689, 509);
    4646      this.scatterPlotView.TabIndex = 0;
    4747      //
     
    5454      this.groupBox1.Location = new System.Drawing.Point(3, 3);
    5555      this.groupBox1.Name = "groupBox1";
    56       this.groupBox1.Size = new System.Drawing.Size(179, 157);
     56      this.groupBox1.Size = new System.Drawing.Size(160, 140);
    5757      this.groupBox1.TabIndex = 1;
    5858      this.groupBox1.TabStop = false;
     
    9595      this.comboBoxXVariable.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
    9696      //
    97       // PreprocessingScatterPlotView
     97      // SingleScatterPlotView
    9898      //
    9999      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     
    101101      this.Controls.Add(this.groupBox1);
    102102      this.Controls.Add(this.scatterPlotView);
    103       this.Name = "PreprocessingScatterPlotView";
     103      this.Name = "SingleScatterPlotView";
    104104      this.Size = new System.Drawing.Size(863, 517);
    105105      this.groupBox1.ResumeLayout(false);
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/SingleScatterPlotView.cs

    r10897 r10915  
    1818namespace HeuristicLab.DataPreprocessing.Views {
    1919
    20   [View("Scatter Plot View")]
     20  [View("Single Scatter Plot View")]
    2121  [Content(typeof(ScatterPlotContent), false)]
    22   public partial class MultiScatterPlotView : ItemView {
     22  public partial class SingleScatterPlotView : ItemView {
    2323
    2424    private IChartLogic logic;
    2525
    26     public MultiScatterPlotView() {
     26    public SingleScatterPlotView() {
    2727      InitializeComponent();
    2828    }
     
    6565    private void UpdateScatterPlot() {
    6666      if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null) {
    67         ScatterPlot scatterPlot = logic.CreateScatterPlot("ScatterPlot", (string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem);
     67        ScatterPlot scatterPlot = logic.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem);
    6868        scatterPlotView.Content = scatterPlot;
    6969      }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ChartLogic.cs

    r10908 r10915  
    160160    }
    161161
    162     public ScatterPlot CreateScatterPlot(string name, string variableNameX, string variableNameY) {
    163       ScatterPlot scatterPlot = new ScatterPlot(name, "");
     162    public ScatterPlot CreateScatterPlot(string variableNameX, string variableNameY) {
     163      ScatterPlot scatterPlot = new ScatterPlot();
    164164     
    165165
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ScatterPlotContent.cs

    r10882 r10915  
    2929  public class ScatterPlotContent : PreprocessingChartContent {
    3030
     31    public string SelectedXVariable { get; set; }
     32
     33    public string SelectedYVariable { get; set; }
     34
    3135    public ScatterPlotContent(IChartLogic chartlogic)
    3236      : base(chartlogic) {
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IChartLogic.cs

    r10908 r10915  
    4545    DataRow CreateDataRowRange(string variableName, int start, int end, DataRowVisualProperties.DataRowChartType chartType);
    4646
    47     ScatterPlot CreateScatterPlot(string name,string variableNameX,string variableNameY);
     47    ScatterPlot CreateScatterPlot(string variableNameX,string variableNameY);
    4848
    4949    string GetVariableNameByIndex(int index);
Note: See TracChangeset for help on using the changeset viewer.