Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/18/08 23:17:23 (15 years ago)
Author:
mstoeger
Message:

Modified the XAxis labels so they are always visible at the bottom. (#433)
Added simple layout management to the line chart's root shape containing a title-, lines- and xaxis-area. (#345)

Location:
trunk/sources/HeuristicLab.Visualization.Test
Files:
4 edited

Legend:

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

    r986 r1038  
    2626      this.lineChartGroupBox = new System.Windows.Forms.GroupBox();
    2727      this.btnResetView = new System.Windows.Forms.Button();
     28      this.btnAddRandomValue = new System.Windows.Forms.Button();
    2829      this.SuspendLayout();
    2930      //
     
    3536      this.lineChartGroupBox.Location = new System.Drawing.Point(12, 12);
    3637      this.lineChartGroupBox.Name = "lineChartGroupBox";
    37       this.lineChartGroupBox.Size = new System.Drawing.Size(607, 318);
     38      this.lineChartGroupBox.Size = new System.Drawing.Size(673, 376);
    3839      this.lineChartGroupBox.TabIndex = 0;
    3940      this.lineChartGroupBox.TabStop = false;
     
    4344      //
    4445      this.btnResetView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    45       this.btnResetView.Location = new System.Drawing.Point(544, 346);
     46      this.btnResetView.Location = new System.Drawing.Point(610, 404);
    4647      this.btnResetView.Name = "btnResetView";
    4748      this.btnResetView.Size = new System.Drawing.Size(75, 23);
     
    5152      this.btnResetView.Click += new System.EventHandler(this.btnResetView_Click);
    5253      //
     54      // btnAddRandomValue
     55      //
     56      this.btnAddRandomValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     57      this.btnAddRandomValue.Location = new System.Drawing.Point(529, 404);
     58      this.btnAddRandomValue.Name = "btnAddRandomValue";
     59      this.btnAddRandomValue.Size = new System.Drawing.Size(75, 23);
     60      this.btnAddRandomValue.TabIndex = 2;
     61      this.btnAddRandomValue.Text = "Add Value";
     62      this.btnAddRandomValue.UseVisualStyleBackColor = true;
     63      this.btnAddRandomValue.Click += new System.EventHandler(this.btnAddRandomValue_Click);
     64      //
    5365      // LineChartTestForm
    5466      //
    5567      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    5668      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    57       this.ClientSize = new System.Drawing.Size(631, 395);
     69      this.ClientSize = new System.Drawing.Size(697, 453);
     70      this.Controls.Add(this.btnAddRandomValue);
    5871      this.Controls.Add(this.lineChartGroupBox);
    5972      this.Controls.Add(this.btnResetView);
     
    6881    private System.Windows.Forms.GroupBox lineChartGroupBox;
    6982    private System.Windows.Forms.Button btnResetView;
     83    private System.Windows.Forms.Button btnAddRandomValue;
    7084
    7185  }
  • trunk/sources/HeuristicLab.Visualization.Test/LineChartTestForm.cs

    r985 r1038  
    1 using System.Windows.Forms;
     1using System;
     2using System.Windows.Forms;
    23using HeuristicLab.Core;
    34
    45namespace HeuristicLab.Visualization.Test {
    56  public partial class LineChartTestForm : Form {
     7    private readonly IView view;
    68    private ChartDataRowsModel model;
    7     private IView view;
    89
    910    public LineChartTestForm() {
    1011      InitializeComponent();
     12    }
    1113
    12       model = new ChartDataRowsModel();
    13 
    14      
     14    public LineChartTestForm(ChartDataRowsModel model) : this() {
     15      this.model = model;
    1516      view = model.CreateView();
    1617
     
    2122    }
    2223
    23     public ChartDataRowsModel Model {
    24       get { return model; }
     24    private void btnResetView_Click(object sender, EventArgs e) {
     25      if (view != null) {
     26        LineChart lineChart = (LineChart)view;
     27        lineChart.ResetView();
     28      }
    2529    }
    2630
    27     private void btnResetView_Click(object sender, System.EventArgs e) {
    28       LineChart lineChart = (LineChart)view;
    29       lineChart.ResetView();
     31    private void btnAddRandomValue_Click(object sender, EventArgs e) {
     32      Random rand = new Random();
     33
     34      foreach (IDataRow row in model.Rows)
     35        row.AddValue(rand.NextDouble()*100);
    3036    }
    3137  }
  • trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs

    r983 r1038  
    66  [TestFixture]
    77  public class LineChartTests {
     8    private ChartDataRowsModel model;
     9
     10    [SetUp]
     11    public void SetUp() {
     12      model = new ChartDataRowsModel();
     13    }
     14
    815    [Test]
    916    public void TestLineChart() {
    10       LineChartTestForm f = new LineChartTestForm();
     17      LineChartTestForm f = new LineChartTestForm(model);
    1118
    1219      IDataRow row1 = new DataRow();
     
    2734     
    2835
    29       f.Model.AddDataRow(row1);
    30       f.Model.AddDataRow(row2);
    31       f.Model.AddDataRow(row3);
     36      model.AddDataRow(row1);
     37      model.AddDataRow(row2);
     38      model.AddDataRow(row3);
    3239
    3340      row1.AddValue(10);
     
    5057      Random rand = new Random();
    5158
    52       for (int i = 0; i < 1000; i++) {
     59      for (int i = 0; i < 10000; i++) {
    5360        row1.AddValue(rand.NextDouble()*10);
    5461        row2.AddValue(rand.NextDouble()*10);
     
    6168    [Test]
    6269    public void TestAxes() {
    63       LineChartTestForm f = new LineChartTestForm();
     70      LineChartTestForm f = new LineChartTestForm(model);
    6471
    6572      IDataRow row1 = new DataRow();
     
    6976      row1.Style = DrawingStyle.Solid;
    7077
    71       f.Model.AddDataRow(row1);
     78      model.AddDataRow(row1);
    7279
    7380      row1.AddValue(10);
  • trunk/sources/HeuristicLab.Visualization.Test/MainForm.cs

    r865 r1038  
    3030      WorldShape mainWorld = canvasUI.MainCanvas.WorldShape;
    3131      // simple rectangle shape
    32       RectangleShape rect7 = new RectangleShape(5, 5, 50, 50, 0, Color.Black);
     32      RectangleShape rect7 = new RectangleShape(5, 5, 50, 50, Color.Black);
    3333      mainWorld.AddShape(rect7);
    3434    }
     
    4343
    4444      for (int i = 0; i < 10000; i++) {
    45         RectangleShape rect = new RectangleShape(x1, y1, x1 + 0.3, y1 + 0.3, 0, Color.Maroon);
     45        RectangleShape rect = new RectangleShape(x1, y1, x1 + 0.3, y1 + 0.3, Color.Maroon);
    4646        x1 += 0.4;
    4747        y1 += 0.4;
     
    5757      CompositeShape middleComp = new CompositeShape();
    5858
    59       RectangleShape rect5 = new RectangleShape(400, 10, 500, 300, 0, Color.Navy);
    60       RectangleShape rect6 = new RectangleShape(510, 310, 580, 590, 0, Color.Magenta);
     59      RectangleShape rect5 = new RectangleShape(400, 10, 500, 300, Color.Navy);
     60      RectangleShape rect6 = new RectangleShape(510, 310, 580, 590, Color.Magenta);
    6161
    6262      middleComp.AddShape(rect5);
     
    7171      WorldShape leftWorld = new WorldShape(new RectangleD(0, 0, 1000, 1000), new RectangleD(10, 10, 380, 590));
    7272
    73       RectangleShape fillRect = new RectangleShape(0, 0, 1000, 1000, 0, Color.LightBlue);
     73      RectangleShape fillRect = new RectangleShape(0, 0, 1000, 1000, Color.LightBlue);
    7474
    75       RectangleShape rect1 = new RectangleShape(100, 100, 500, 500, 0, Color.Red);
    76       RectangleShape rect2 = new RectangleShape(800, -200, 1200, 500, 0, Color.Green);
     75      RectangleShape rect1 = new RectangleShape(100, 100, 500, 500, Color.Red);
     76      RectangleShape rect2 = new RectangleShape(800, -200, 1200, 500, Color.Green);
    7777
    7878      CompositeShape comp1 = new CompositeShape();
    7979
    80       RectangleShape rect3 = new RectangleShape(510, 580, 590, 700, 0, Color.Blue);
    81       RectangleShape rect4 = new RectangleShape(600, 710, 800, 900, 0, Color.Orange);
     80      RectangleShape rect3 = new RectangleShape(510, 580, 590, 700, Color.Blue);
     81      RectangleShape rect4 = new RectangleShape(600, 710, 800, 900, Color.Orange);
    8282
    8383      comp1.AddShape(rect3);
Note: See TracChangeset for help on using the changeset viewer.