Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1458 for trunk/sources


Ignore:
Timestamp:
03/27/09 17:48:20 (15 years ago)
Author:
mstoeger
Message:

Add option for grid visibility and color (#555)

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r1457 r1458  
    8787      yaxis1.Position = AxisPosition.Left;
    8888      yaxis2.Position = AxisPosition.Right;
     89
     90      yaxis1.ShowGrid = true;
     91      yaxis2.ShowGrid = false;
     92
     93      yaxis1.GridColor = Color.Gray;
    8994
    9095      row1.Color = Color.Red;
  • trunk/sources/HeuristicLab.Visualization/Grid.cs

    r1240 r1458  
    33namespace HeuristicLab.Visualization {
    44  public class Grid : WorldShape {
     5    private Color color = Color.LightBlue;
     6
    57    public override void Draw(Graphics graphics) {
    68      ClearShapes();
     
    1214        LineShape line = new LineShape(ClippingArea.X1, y,
    1315                                       ClippingArea.X2, y,
    14                                        Color.LightBlue, 1,
     16                                       color, 1,
    1517                                       DrawingStyle.Dashed);
    1618        AddShape(line);
     
    2325        LineShape line = new LineShape(x, ClippingArea.Y1,
    2426                                       x, ClippingArea.Y2,
    25                                        Color.LightBlue, 1,
     27                                       color, 1,
    2628                                       DrawingStyle.Dashed);
    2729        AddShape(line);
     
    3032      LineShape lineZeroX = new LineShape(0, ClippingArea.Y1,
    3133                                          0, ClippingArea.Y2,
    32                                           Color.LightBlue, 3,
     34                                          color, 3,
    3335                                          DrawingStyle.Dashed);
    3436
    3537      LineShape lineZeroY = new LineShape(ClippingArea.X1, 0,
    3638                                          ClippingArea.X2, 0,
    37                                           Color.LightBlue, 3,
     39                                          color, 3,
    3840                                          DrawingStyle.Dashed);
    3941
     
    4345      base.Draw(graphics);
    4446    }
     47
     48    public Color Color {
     49      get { return color; }
     50      set { color = value; }
     51    }
    4552  }
    4653}
  • trunk/sources/HeuristicLab.Visualization/LineChart.cs

    r1457 r1458  
    8585      foreach (YAxisDescriptor yAxisDescriptor in model.YAxes) {
    8686        YAxisInfo info = GetYAxisInfo(yAxisDescriptor);
    87         canvas.AddShape(info.Grid);
     87        if (yAxisDescriptor.ShowGrid) {
     88          info.Grid.Color = yAxisDescriptor.GridColor;
     89          canvas.AddShape(info.Grid);
     90        }
    8891      }
    8992
  • trunk/sources/HeuristicLab.Visualization/YAxisDescriptor.cs

    r1457 r1458  
    11using System;
    22using System.Collections.Generic;
     3using System.Drawing;
    34using HeuristicLab.Visualization.LabelProvider;
    45using HeuristicLab.Visualization.Test;
     
    1415    public bool ClipChangeable = true;
    1516    private AxisPosition position = AxisPosition.Left;
     17
     18    private bool showGrid = true;
     19    private Color gridColor = Color.LightBlue;
    1620
    1721    public event YAxisDescriptorChangedHandler YAxisDescriptorChanged;
     
    8286    public AxisPosition Position {
    8387      get { return position; }
    84       set { position = value; }
     88      set {
     89        position = value;
     90        OnYAxisDescriptorChanged();
     91      }
     92    }
     93
     94    public bool ShowGrid {
     95      get { return showGrid; }
     96      set {
     97        showGrid = value;
     98        OnYAxisDescriptorChanged();
     99      }
     100    }
     101
     102    public Color GridColor {
     103      get { return gridColor; }
     104      set {
     105        gridColor = value;
     106        OnYAxisDescriptorChanged();
     107      }
    85108    }
    86109
Note: See TracChangeset for help on using the changeset viewer.