Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1343 for trunk


Ignore:
Timestamp:
03/13/09 19:18:21 (15 years ago)
Author:
mstoeger
Message:

Display of Y-Axes can be individually switched on and off in the options dialog. (#433)

Location:
trunk/sources
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs

    r1342 r1343  
    8181      row1.Thickness = 3;
    8282      row1.Style = DrawingStyle.Solid;
     83      row1.Label = "Die Rote";
    8384
    8485      row2.Color = Color.Green;
    8586      row2.Thickness = 3;
    8687      row2.Style = DrawingStyle.Solid;
     88      row2.Label = "Die Grüne";
    8789
    8890      model.AddDataRow(row1);
  • trunk/sources/HeuristicLab.Visualization/AvgAggregator.cs

    r1327 r1343  
    110110    }
    111111
     112    private bool showYAxis = false;
     113
     114    public bool ShowYAxis {
     115      get { return showYAxis; }
     116      set {
     117        showYAxis = value;
     118        OnDataRowChanged(this);
     119      }
     120    }
     121
    112122    public LabelProvider.ILabelProvider YAxisLabelProvider {
    113123      get {
  • trunk/sources/HeuristicLab.Visualization/AvgLineAggregator.cs

    r1327 r1343  
    124124    }
    125125
     126
     127    private bool showYAxis = false;
     128
     129    public bool ShowYAxis {
     130      get { return showYAxis; }
     131      set {
     132        showYAxis = value;
     133        OnDataRowChanged(this);
     134      }
     135    }
     136
    126137    public LabelProvider.ILabelProvider YAxisLabelProvider {
    127138      get {
  • trunk/sources/HeuristicLab.Visualization/DataRow.cs

    r1285 r1343  
    8383      }
    8484    }
    85 
    8685 
    8786    public string Label {
     
    114113      set {
    115114        style = value;
     115        OnDataRowChanged(this);
     116      }
     117    }
     118
     119    private bool showYAxis = true;
     120
     121    public virtual bool ShowYAxis {
     122      get { return showYAxis; }
     123      set {
     124        showYAxis = value;
    116125        OnDataRowChanged(this);
    117126      }
  • trunk/sources/HeuristicLab.Visualization/IDataRow.cs

    r1325 r1343  
    1414    DrawingStyle Style { get; set; }
    1515    DataRowType LineType { get; set; }
     16 
     17    bool ShowYAxis { get; set; }
    1618    ILabelProvider YAxisLabelProvider { get; set; }
    1719
  • trunk/sources/HeuristicLab.Visualization/LineChart.cs

    r1342 r1343  
    109109      canvas.AddShape(xAxis);
    110110
    111       foreach (RowEntry rowEntry in rowEntries) {
    112         canvas.AddShape(rowEntry.YAxis);
     111      int yAxesWidth = 0;
     112
     113      foreach (RowEntry rowEntry in rowEntries) {
     114        if (rowEntry.DataRow.ShowYAxis) {
     115          canvas.AddShape(rowEntry.YAxis);
     116          yAxesWidth += YAxisWidth;
     117        }
    113118      }
    114119
     
    120125      titleShape.X = 10;
    121126      titleShape.Y = canvasUI.Height - 10;
    122 
    123       int yAxesWidth = 0;
    124 
    125       foreach (RowEntry rowEntry in rowEntries) {
    126         if (rowEntry.YAxis.Visible) {
    127           yAxesWidth += YAxisWidth;
    128         }
    129       }
    130127
    131128      RectangleD linesAreaBoundingBox = new RectangleD(yAxesWidth,
     
    141138      int yAxisLeft = 0;
    142139      foreach (RowEntry rowEntry in rowEntries) {
    143         rowEntry.YAxis.BoundingBox = new RectangleD(yAxisLeft,
    144                                                     linesAreaBoundingBox.Y1,
    145                                                     yAxisLeft + YAxisWidth,
    146                                                     linesAreaBoundingBox.Y2);
    147         yAxisLeft += YAxisWidth;
     140        if (rowEntry.DataRow.ShowYAxis) {
     141          rowEntry.YAxis.BoundingBox = new RectangleD(yAxisLeft,
     142                                                      linesAreaBoundingBox.Y1,
     143                                                      yAxisLeft + YAxisWidth,
     144                                                      linesAreaBoundingBox.Y2);
     145          yAxisLeft += YAxisWidth;
     146        }
    148147      }
    149148
     
    206205
    207206      rowEntry.LinesShape.UpdateStyle(row);
     207
     208      UpdateLayout();
    208209
    209210      canvasUI.Invalidate();
  • trunk/sources/HeuristicLab.Visualization/MaxAggregator.cs

    r1327 r1343  
    113113    }
    114114
     115    private bool showYAxis = false;
     116
     117    public bool ShowYAxis {
     118      get { return showYAxis; }
     119      set {
     120        showYAxis = value;
     121        OnDataRowChanged(this);
     122      }
     123    }
     124
    115125    public LabelProvider.ILabelProvider YAxisLabelProvider {
    116126      get {
  • trunk/sources/HeuristicLab.Visualization/MinAggregator.cs

    r1327 r1343  
    112112    }
    113113
     114
     115    private bool showYAxis = false;
     116
     117    public bool ShowYAxis {
     118      get { return showYAxis; }
     119      set {
     120        showYAxis = value;
     121        OnDataRowChanged(this);
     122      }
     123    }
     124
    114125    private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##");
    115126    public ILabelProvider YAxisLabelProvider {
  • trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.Designer.cs

    r1342 r1343  
    4848      this.tpXAxis = new System.Windows.Forms.TabPage();
    4949      this.btnChangeXAxisFont = new System.Windows.Forms.Button();
     50      this.tpYAxes = new System.Windows.Forms.TabPage();
     51      this.dataRowsFlowLayout = new System.Windows.Forms.FlowLayoutPanel();
    5052      this.tpTitle.SuspendLayout();
    5153      this.tabPage2.SuspendLayout();
     
    5456      this.Optionstabs.SuspendLayout();
    5557      this.tpXAxis.SuspendLayout();
     58      this.tpYAxes.SuspendLayout();
    5659      this.SuspendLayout();
    5760      //
     
    274277      this.Optionstabs.Controls.Add(this.tpTitle);
    275278      this.Optionstabs.Controls.Add(this.tpXAxis);
     279      this.Optionstabs.Controls.Add(this.tpYAxes);
    276280      this.Optionstabs.Location = new System.Drawing.Point(0, 1);
    277281      this.Optionstabs.Name = "Optionstabs";
     
    299303      this.btnChangeXAxisFont.UseVisualStyleBackColor = true;
    300304      this.btnChangeXAxisFont.Click += new System.EventHandler(this.btnChangeXAxisFont_Click);
     305      //
     306      // tpYAxes
     307      //
     308      this.tpYAxes.Controls.Add(this.dataRowsFlowLayout);
     309      this.tpYAxes.Location = new System.Drawing.Point(4, 22);
     310      this.tpYAxes.Name = "tpYAxes";
     311      this.tpYAxes.Padding = new System.Windows.Forms.Padding(3);
     312      this.tpYAxes.Size = new System.Drawing.Size(284, 199);
     313      this.tpYAxes.TabIndex = 4;
     314      this.tpYAxes.Text = "Y-Axes";
     315      this.tpYAxes.UseVisualStyleBackColor = true;
     316      //
     317      // dataRowsFlowLayout
     318      //
     319      this.dataRowsFlowLayout.Dock = System.Windows.Forms.DockStyle.Fill;
     320      this.dataRowsFlowLayout.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
     321      this.dataRowsFlowLayout.Location = new System.Drawing.Point(3, 3);
     322      this.dataRowsFlowLayout.Name = "dataRowsFlowLayout";
     323      this.dataRowsFlowLayout.Size = new System.Drawing.Size(278, 193);
     324      this.dataRowsFlowLayout.TabIndex = 0;
    301325      //
    302326      // OptionsDialog
     
    323347      this.Optionstabs.ResumeLayout(false);
    324348      this.tpXAxis.ResumeLayout(false);
     349      this.tpYAxes.ResumeLayout(false);
    325350      this.ResumeLayout(false);
    326351
     
    353378    private System.Windows.Forms.TabPage tpXAxis;
    354379    private System.Windows.Forms.Button btnChangeXAxisFont;
     380    private System.Windows.Forms.TabPage tpYAxes;
     381    private System.Windows.Forms.FlowLayoutPanel dataRowsFlowLayout;
    355382  }
    356383}
  • trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs

    r1342 r1343  
    2323
    2424    public IList<int> GetThicknesses() {
    25       return new List<int> {0, 1, 2, 3, 4, 5, 6, 7, 8};
     25      return new List<int>(new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8});
    2626    }
    2727
    2828    public IList<DrawingStyle> GetStyles() {
    29       return new List<DrawingStyle> {DrawingStyle.Solid, DrawingStyle.Dashed};
     29      return new List<DrawingStyle>(new DrawingStyle[] {DrawingStyle.Solid, DrawingStyle.Dashed});
    3030    }
    3131
     
    3939        LineSelectCB.SelectedIndex = 0;
    4040        LineSelectCB_SelectedIndexChanged(this, null);
     41      }
     42
     43      InitTabPageYAxes();
     44    }
     45
     46    private void InitTabPageYAxes() {
     47      for (int i = 0; i < model.Rows.Count; i++) {
     48        IDataRow row = model.Rows[i];
     49
     50        CheckBox chkbox = new CheckBox();
     51        chkbox.Text = row.Label;
     52        chkbox.Checked = row.ShowYAxis;
     53        chkbox.CheckedChanged += delegate { row.ShowYAxis = chkbox.Checked; };
     54       
     55        dataRowsFlowLayout.Controls.Add(chkbox);
    4156      }
    4257    }
  • trunk/sources/HeuristicLab.Visualization/YAxis.cs

    r1285 r1343  
    77
    88    private ILabelProvider labelProvider = new ContinuousLabelProvider("e4");
    9     private bool visible = true;
    109
    1110    public ILabelProvider LabelProvider {
     
    1413    }
    1514
    16     public bool Visible {
    17       get { return visible; }
    18       set { visible = value; }
    19     }
    20 
    2115    public override void Draw(Graphics graphics) {
    2216      ClearShapes();
    2317
    24       if (Visible) {
    25         foreach (double y in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Height,
    26                                                 ClippingArea.Height,
    27                                                 ClippingArea.Y1)) {
    28           TextShape label = new TextShape(ClippingArea.X2 - 3, y,
    29                                           labelProvider.GetLabel(y));
    30           label.AnchorPositionX = AnchorPositionX.Right;
    31           label.AnchorPositionY = AnchorPositionY.Middle;
    32           AddShape(label);
    33         }
     18      foreach (double y in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Height,
     19                                              ClippingArea.Height,
     20                                              ClippingArea.Y1)) {
     21        TextShape label = new TextShape(ClippingArea.X2 - 3, y,
     22                                        labelProvider.GetLabel(y));
     23        label.AnchorPositionX = AnchorPositionX.Right;
     24        label.AnchorPositionY = AnchorPositionY.Middle;
     25        AddShape(label);
    3426      }
    3527
Note: See TracChangeset for help on using the changeset viewer.