Free cookie consent management tool by TermsFeed Policy Generator

Changeset 980


Ignore:
Timestamp:
12/12/08 07:15:24 (16 years ago)
Author:
dwagner
Message:

Added feature: Drawingstyle for lines; #345

Location:
trunk/sources
Files:
3 edited

Legend:

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

    r869 r980  
    2020      row2.Thickness = 4;
    2121      row3.Thickness = 5;
     22
     23      row1.Style = DrawingStyle.Solid;
     24      row2.Style = DrawingStyle.Solid;
     25      row3.Style = DrawingStyle.Dashed;
     26     
    2227
    2328      f.Model.AddDataRow(row1);
  • trunk/sources/HeuristicLab.Visualization/LineChart.cs

    r928 r980  
    6969
    7070      for (int i = 1; i < row.Count; i++) {
    71         LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], 0, row.Color, row.Thickness);
     71        LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], 0, row.Color, row.Thickness, row.Style);
    7272        lineShapes.Add(lineShape);
    7373        // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently.
     
    9797      // new value was added
    9898      if (index > 0 && index == lineShapes.Count + 1) {
    99         LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], 0, row.Color, row.Thickness);
     99        LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], 0, row.Color, row.Thickness, row.Style);
    100100        lineShapes.Add(lineShape);
    101101        // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently.
  • trunk/sources/HeuristicLab.Visualization/LineShape.cs

    r870 r980  
    11using System.Drawing;
     2using System.Drawing.Drawing2D;
    23
    34namespace HeuristicLab.Visualization {
     
    78    private Color color;
    89    private int thickness;
     10    private DashStyle dashStyle;
    911
    1012    /// <summary>
     
    1618    /// <param name="y2">y coordinate of right lineEndPoind</param>
    1719    /// <param name="color">color for the LineShape</param>
    18     public LineShape(double x1, double y1, double x2, double y2, double z, Color color, int thickness) {
     20    public LineShape(double x1, double y1, double x2, double y2, double z, Color color, int thickness, DrawingStyle style) {
    1921      this.boundingBox = new RectangleD(x1, y1, x2, y2);
    2022      this.z = z;
    2123      this.color = color;
    2224      this.thickness = thickness;
     25      if (style==DrawingStyle.Dashed) {
     26        this.dashStyle = DashStyle.Dash;
     27      }
     28      else {
     29        this.dashStyle = DashStyle.Solid;        //default
     30      }
    2331    }
    2432
     
    5563    public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
    5664      using (Pen pen = new Pen(color, thickness)){
    57         // TODO there seems to be a bug with drawing straight lines.
     65        pen.DashStyle = this.dashStyle;
    5866        Rectangle screenRect = Transform.ToScreen(boundingBox, viewport, clippingArea);
    5967        graphics.DrawLine(pen,screenRect.Left, screenRect.Bottom, screenRect.Right, screenRect.Top);
Note: See TracChangeset for help on using the changeset viewer.