Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/29/08 13:08:35 (16 years ago)
Author:
mstoeger
Message:

Adjustments on LineChart for new interface. #345

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

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/CanvasUI.cs

    r725 r869  
    22using System.Diagnostics;
    33using System.Drawing;
     4using System.Drawing.Drawing2D;
    45using System.Windows.Forms;
    56
     
    2627        Graphics g = pe.Graphics;
    2728
     29        g.SmoothingMode = SmoothingMode.AntiAlias;
     30
    2831        g.FillRectangle(Brushes.White, ClientRectangle);
    2932
     
    3639       Debug.WriteLine(e);
    3740      }
     41    }
     42
     43    protected override void OnResize(EventArgs e) {
     44      Invalidate();
     45
     46      base.OnResize(e);
    3847    }
    3948
  • trunk/sources/HeuristicLab.Visualization/LineChart.Designer.cs

    r754 r869  
    3434          // canvasUI1
    3535          //
    36           this.canvasUI1.Location = new System.Drawing.Point(3, 3);
     36          this.canvasUI1.Dock = System.Windows.Forms.DockStyle.Fill;
     37          this.canvasUI1.Location = new System.Drawing.Point(0, 0);
    3738          this.canvasUI1.MouseEventListener = null;
    3839          this.canvasUI1.Name = "canvasUI1";
    39           this.canvasUI1.Size = new System.Drawing.Size(546, 384);
     40          this.canvasUI1.Size = new System.Drawing.Size(552, 390);
    4041          this.canvasUI1.TabIndex = 0;
    4142          this.canvasUI1.Text = "canvasUI1";
  • trunk/sources/HeuristicLab.Visualization/LineChart.cs

    r861 r869  
    2222        throw new NullReferenceException("Model cannot be null.");
    2323
    24       this.model = model;
    25       this.Item = (IItem)model;
    26 
    2724      //TODO: correct Rectangle to fit
    2825      RectangleD clientRectangle = new RectangleD(-1, -1, 11, 11);
    2926      canvasUI1.MainCanvas.WorldShape = new WorldShape(clientRectangle, clientRectangle);
     27
     28      this.model = model;
     29      this.Item = (IItem)model;
    3030    }
    3131
     
    3838      model.DataRowRemoved += OnDataRowRemoved;
    3939      model.ModelChanged += OnModelChanged;
     40
     41      foreach (IDataRow row in model.Rows) {
     42        OnDataRowAdded(row);
     43      }
    4044    }
    4145
     
    5963
    6064      for (int i = 1; i < row.Count; i++) {
    61         LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], 0, row.Color);
     65        LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], 0, row.Color, row.Thickness);
    6266        lineShapes.Add(lineShape);
    6367        canvasUI1.MainCanvas.WorldShape.AddShape(lineShape);
     
    7680    private readonly IDictionary<IDataRow, List<LineShape>> rowToLineShapes = new Dictionary<IDataRow, List<LineShape>>();
    7781
    78     private void OnRowValueChanged(IDataRow row, double value, int index) {
     82    private void OnRowValueChanged(IDataRow row, double value, int index, Action action) {
    7983      List<LineShape> lineShapes = rowToLineShapes[row];
    8084
     
    8488      // new value was added
    8589      if (index > 0 && index == lineShapes.Count+1) {
    86         LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], 0, row.Color);
     90        LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], 0, row.Color, row.Thickness);
    8791        lineShapes.Add(lineShape);
    8892        canvasUI1.MainCanvas.WorldShape.AddShape(lineShape);
     
    9498
    9599      // not the last value
    96       if (index > 0 && index < row.Count)
     100      if (index > 0 && index < row.Count-1)
    97101        lineShapes[index].Y1 = value;
    98102
     
    100104    }
    101105
    102     private void OnRowValuesChanged(IDataRow row, double[] values, int index) {
     106    private void OnRowValuesChanged(IDataRow row, double[] values, int index, Action action) {
    103107      foreach (double value in values) {
    104         OnRowValueChanged(row, value, index++);
     108        OnRowValueChanged(row, value, index++, action);
    105109      }
    106110    }
  • trunk/sources/HeuristicLab.Visualization/LineShape.cs

    r861 r869  
    66    private double z;
    77    private Color color;
     8    private int thickness;
    89
    910    /// <summary>
     
    1516    /// <param name="y2">y coordinate of right lineEndPoind</param>
    1617    /// <param name="color">color for the LineShape</param>
    17     public LineShape(double x1, double y1, double x2, double y2, double z, Color color) {
     18    public LineShape(double x1, double y1, double x2, double y2, double z, Color color, int thickness) {
    1819      this.boundingBox = new RectangleD(x1, y1, x2, y2);
    1920      this.z = z;
    2021      this.color = color;
     22      this.thickness = thickness;
    2123    }
    2224
     
    5254    /// <param name="clippingArea">rectangle in screen-coordinates to draw</param>
    5355    public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
    54       using (Pen pen = new Pen(color, 3)){
     56      using (Pen pen = new Pen(color, thickness)){
    5557        Rectangle screenRect = Transform.ToScreen(boundingBox, viewport, clippingArea);
    5658        graphics.DrawLine(pen,screenRect.Left, screenRect.Bottom, screenRect.Right, screenRect.Top);
Note: See TracChangeset for help on using the changeset viewer.