Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1876 for trunk


Ignore:
Timestamp:
05/23/09 08:28:50 (16 years ago)
Author:
mstoeger
Message:

x-axis grid can be enabled/disabled #629

Location:
trunk/sources
Files:
1 added
7 edited
1 moved

Legend:

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

    r1818 r1876  
    130130      };
    131131
     132      f.ShowDialog();
     133    }
     134
     135    [Test]
     136    public void TestGridX() {
     137      LineChartTestForm f = new LineChartTestForm(model);
     138      IDataRow row1 = new DataRow();
     139      model.AddDataRow(row1);
     140
     141      model.ShowXAxisGrid = false;
     142
     143      Random rand = new Random(42);
     144      for (int i = 0; i < 10; i++) {
     145        row1.AddValue(rand.NextDouble() * 10);
     146      }
    132147      f.ShowDialog();
    133148    }
  • trunk/sources/HeuristicLab.Visualization/3.2/ChartDataRowsModel.cs

    r1530 r1876  
    1717    private string xAxisLabel = "";
    1818    private bool showXAxisLabel = true;
     19    private bool showXAxisGrid = true;
    1920    private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##");
    2021
    2122    private ViewSettings viewSettings = new ViewSettings();
     23
     24    public bool ShowXAxisGrid {
     25      get { return showXAxisGrid; }
     26      set {
     27        this.showXAxisGrid = value;
     28        OnModelChanged();
     29      }
     30    }
    2231
    2332    public ILabelProvider XAxisLabelProvider {
  • trunk/sources/HeuristicLab.Visualization/3.2/HeuristicLab.Visualization-3.2.csproj

    r1818 r1876  
    115115    <Compile Include="LabelProvider\ContinuousLabelProvider.cs" />
    116116    <Compile Include="LabelProvider\DiscreteLabelProvider.cs" />
    117     <Compile Include="Grid.cs" />
     117    <Compile Include="YAxisGrid.cs" />
    118118    <Compile Include="HorizontalLineShape.cs" />
    119119    <Compile Include="LabelProvider\ILabelProvider.cs" />
     
    164164    <Compile Include="WorldShape.cs" />
    165165    <Compile Include="XAxis.cs" />
     166    <Compile Include="XAxisGrid.cs" />
    166167    <Compile Include="YAxis.cs" />
    167168    <Compile Include="YAxisDescriptor.cs" />
  • trunk/sources/HeuristicLab.Visualization/3.2/IChartDataRowsModel.cs

    r1530 r1876  
    2121    string XAxisLabel { get; set; }
    2222    bool ShowXAxisLabel { get; set; }
     23    bool ShowXAxisGrid { get; set; }
    2324
    2425    event ModelChangedHandler ModelChanged;
  • trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs

    r1839 r1876  
    1818    private readonly LegendShape legendShape = new LegendShape();
    1919    private readonly XAxis xAxis = new XAxis();
     20    private readonly XAxisGrid xAxisGrid = new XAxisGrid();
    2021    private readonly List<RowEntry> rowEntries = new List<RowEntry>();
    2122
     
    8788
    8889      titleShape.Text = model.Title;
     90
     91      if (model.ShowXAxisGrid) {
     92        canvas.AddShape(xAxisGrid);
     93      }
    8994
    9095      foreach (YAxisDescriptor yAxisDescriptor in model.YAxes) {
     
    144149        rowEntry.LinesShape.BoundingBox = linesAreaBoundingBox;
    145150      }
     151
     152      xAxisGrid.BoundingBox = linesAreaBoundingBox;
    146153
    147154      foreach (YAxisDescriptor yAxisDescriptor in model.YAxes) {
     
    348355
    349356    private void SetClipX(double x1, double x2) {
     357      xAxisGrid.ClippingArea = new RectangleD(x1,
     358                                              xAxisGrid.ClippingArea.Y1,
     359                                              x2,
     360                                              xAxisGrid.ClippingArea.Y2);
     361
    350362      xAxis.ClippingArea = new RectangleD(x1,
    351363                                          0,
     
    374386
    375387    private void SetClipY(RowEntry rowEntry, double y1, double y2) {
     388      xAxisGrid.ClippingArea = new RectangleD(xAxisGrid.ClippingArea.X1,
     389                                              y1,
     390                                              xAxisGrid.ClippingArea.X2,
     391                                              y2);
     392
    376393      rowEntry.LinesShape.ClippingArea = new RectangleD(rowEntry.LinesShape.ClippingArea.X1,
    377394                                                        y1,
     
    469486
    470487    private void OnModelChanged() {
     488      UpdateLayout();
    471489      canvasUI.Invalidate();
    472490    }
     
    671689
    672690    private class YAxisInfo {
    673       private readonly Grid grid = new Grid();
     691      private readonly YAxisGrid grid = new YAxisGrid();
    674692      private readonly YAxis yAxis = new YAxis();
    675693
    676       public Grid Grid {
     694      public YAxisGrid Grid {
    677695        get { return grid; }
    678696      }
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.Designer.cs

    r1839 r1876  
    5353      this.flpShowYAxis = new System.Windows.Forms.FlowLayoutPanel();
    5454      this.fdFont = new System.Windows.Forms.FontDialog();
     55      this.chkShowXAxisGrid = new System.Windows.Forms.CheckBox();
    5556      this.Optionstabs.SuspendLayout();
    5657      this.tabPage1.SuspendLayout();
     
    286287      // tpXAxis
    287288      //
     289      this.tpXAxis.Controls.Add(this.chkShowXAxisGrid);
    288290      this.tpXAxis.Controls.Add(this.btnChangeXAxisFont);
    289291      this.tpXAxis.Location = new System.Drawing.Point(4, 22);
     
    357359      this.flpShowYAxis.Size = new System.Drawing.Size(275, 57);
    358360      this.flpShowYAxis.TabIndex = 0;
     361      //
     362      // chkShowXAxisGrid
     363      //
     364      this.chkShowXAxisGrid.AutoSize = true;
     365      this.chkShowXAxisGrid.Location = new System.Drawing.Point(3, 32);
     366      this.chkShowXAxisGrid.Name = "chkShowXAxisGrid";
     367      this.chkShowXAxisGrid.Size = new System.Drawing.Size(107, 17);
     368      this.chkShowXAxisGrid.TabIndex = 3;
     369      this.chkShowXAxisGrid.Text = "Show X-Axis Grid";
     370      this.chkShowXAxisGrid.UseVisualStyleBackColor = true;
     371      this.chkShowXAxisGrid.CheckedChanged += new System.EventHandler(this.chkShowXAxisGrid_CheckedChanged);
    359372      //
    360373      // Options
     
    376389      this.tpTitle.PerformLayout();
    377390      this.tpXAxis.ResumeLayout(false);
     391      this.tpXAxis.PerformLayout();
    378392      this.tpYAxes.ResumeLayout(false);
    379393      this.tpYAxes.PerformLayout();
     
    415429    private System.Windows.Forms.FlowLayoutPanel flpShowYAxis;
    416430    private System.Windows.Forms.FontDialog fdFont;
     431    private System.Windows.Forms.CheckBox chkShowXAxisGrid;
    417432    private System.Windows.Forms.TextBox tbxTitle;
    418433    private System.Windows.Forms.Label label5;
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.cs

    r1839 r1876  
    1313    private string oldTitle;
    1414    private Dictionary<CheckBox, bool> ShowYAxisBoxes;
     15    private bool oldShowXAxisGrid;
    1516    private Dictionary<CheckBox, bool> yAxisClipChangeableBoxes;
    1617
     
    6566
    6667    public void ResetSettings() {
     68      model.ShowXAxisGrid = oldShowXAxisGrid;
     69
    6770      foreach (var param in oldLineParams) {
    6871        param.applySettings();
     
    150153
    151154    private void Options_Load(object sender, EventArgs e) {
     155      oldShowXAxisGrid = model.ShowXAxisGrid;
     156      chkShowXAxisGrid.Checked = model.ShowXAxisGrid;
     157
    152158      InitTabPageLines();
    153159      InitTabPageYAxes();
     
    238244    }
    239245
     246    private void chkShowXAxisGrid_CheckedChanged(object sender, EventArgs e) {
     247      model.ShowXAxisGrid = chkShowXAxisGrid.Checked;
     248    }
     249
    240250    private void tbxTitle_TextChanged(object sender, EventArgs e) {
    241251      model.Title = tbxTitle.Text;
  • trunk/sources/HeuristicLab.Visualization/3.2/YAxisGrid.cs

    r1838 r1876  
    22
    33namespace HeuristicLab.Visualization {
    4   public class Grid : WorldShape {
     4  public class YAxisGrid : WorldShape {
    55    private Color color = Color.LightBlue;
    66
     
    1414        LineShape line = new LineShape(ClippingArea.X1, y,
    1515                                       ClippingArea.X2, y,
    16                                        color, 1,
    17                                        DrawingStyle.Dashed);
    18         AddShape(line);
    19       }
    20 
    21       foreach (double x in AxisTicks.GetTicks(XAxis.PixelsPerInterval,
    22                                               Parent.Viewport.Width,
    23                                               ClippingArea.Width,
    24                                               ClippingArea.X1)) {
    25         LineShape line = new LineShape(x, ClippingArea.Y1,
    26                                        x, ClippingArea.Y2,
    2716                                       color, 1,
    2817                                       DrawingStyle.Dashed);
Note: See TracChangeset for help on using the changeset viewer.