Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1885


Ignore:
Timestamp:
05/23/09 11:08:42 (15 years ago)
Author:
mstoeger
Message:

xaxis grid color can be set in the options dialog #555

Location:
trunk/sources
Files:
3 added
6 edited

Legend:

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

    r1884 r1885  
    7979      IDataRow row3 = new DataRow();
    8080
     81      model.XAxis.Label = "X Axis";
     82      model.XAxis.ShowLabel = true;
     83      model.XAxis.ShowGrid = true;
     84      model.XAxis.GridColor = Color.Blue;
     85
    8186      YAxisDescriptor yaxis1 = model.DefaultYAxis;
    8287      YAxisDescriptor yaxis2 = new YAxisDescriptor();
    83 
    84       model.XAxis.Label = "X Axis";
    85       model.XAxis.ShowLabel = true;
    8688
    8789      yaxis1.Label = "Y-Axis 1";
     
    130132      };
    131133
    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.XAxis.ShowGrid = false;
    142 
    143       Random rand = new Random(42);
    144       for (int i = 0; i < 10; i++) {
    145         row1.AddValue(rand.NextDouble() * 10);
    146       }
    147134      f.ShowDialog();
    148135    }
  • trunk/sources/HeuristicLab.Visualization/3.2/HeuristicLab.Visualization-3.2.csproj

    r1883 r1885  
    115115    <Compile Include="LabelProvider\ContinuousLabelProvider.cs" />
    116116    <Compile Include="LabelProvider\DiscreteLabelProvider.cs" />
     117    <Compile Include="Options\ColorSelection.cs">
     118      <SubType>UserControl</SubType>
     119    </Compile>
     120    <Compile Include="Options\ColorSelection.Designer.cs">
     121      <DependentUpon>ColorSelection.cs</DependentUpon>
     122    </Compile>
    117123    <Compile Include="XAxisDescriptor.cs" />
    118124    <Compile Include="YAxisGrid.cs" />
     
    197203      <SubType>Designer</SubType>
    198204    </EmbeddedResource>
     205    <EmbeddedResource Include="Options\ColorSelection.resx">
     206      <DependentUpon>ColorSelection.cs</DependentUpon>
     207    </EmbeddedResource>
    199208    <EmbeddedResource Include="Options\Options.resx">
    200209      <DependentUpon>Options.cs</DependentUpon>
  • trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs

    r1883 r1885  
    101101
    102102      if (model.XAxis.ShowGrid) {
     103        xAxisGrid.Color = model.XAxis.GridColor;
    103104        canvas.AddShape(xAxisGrid);
    104105      }
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.Designer.cs

    r1876 r1885  
    2626      this.Optionstabs = new System.Windows.Forms.TabControl();
    2727      this.tabPage1 = new System.Windows.Forms.TabPage();
    28       this.OptionsDialogSelectColorBtn = new System.Windows.Forms.Button();
    29       this.ColorPreviewTB = new System.Windows.Forms.TextBox();
    3028      this.label2 = new System.Windows.Forms.Label();
    3129      this.LinestyleCB = new System.Windows.Forms.ComboBox();
     
    4644      this.btnChangeTitleFont = new System.Windows.Forms.Button();
    4745      this.tpXAxis = new System.Windows.Forms.TabPage();
     46      this.chkShowXAxisGrid = new System.Windows.Forms.CheckBox();
    4847      this.btnChangeXAxisFont = new System.Windows.Forms.Button();
    4948      this.tpYAxes = new System.Windows.Forms.TabPage();
     
    5352      this.flpShowYAxis = new System.Windows.Forms.FlowLayoutPanel();
    5453      this.fdFont = new System.Windows.Forms.FontDialog();
    55       this.chkShowXAxisGrid = new System.Windows.Forms.CheckBox();
     54      this.label6 = new System.Windows.Forms.Label();
     55      this.groupBox2 = new System.Windows.Forms.GroupBox();
     56      this.selectedLineColorSelection = new HeuristicLab.Visualization.Options.ColorSelection();
     57      this.xAxisGridColorSelection = new HeuristicLab.Visualization.Options.ColorSelection();
    5658      this.Optionstabs.SuspendLayout();
    5759      this.tabPage1.SuspendLayout();
     
    6365      this.gbxYAxisClipChangeable.SuspendLayout();
    6466      this.gbxShowYAxis.SuspendLayout();
     67      this.groupBox2.SuspendLayout();
    6568      this.SuspendLayout();
    6669      //
     
    8184      // tabPage1
    8285      //
    83       this.tabPage1.Controls.Add(this.OptionsDialogSelectColorBtn);
    84       this.tabPage1.Controls.Add(this.ColorPreviewTB);
    8586      this.tabPage1.Controls.Add(this.label2);
    8687      this.tabPage1.Controls.Add(this.LinestyleCB);
     
    9697      this.tabPage1.UseVisualStyleBackColor = true;
    9798      //
    98       // OptionsDialogSelectColorBtn
    99       //
    100       this.OptionsDialogSelectColorBtn.Location = new System.Drawing.Point(217, 126);
    101       this.OptionsDialogSelectColorBtn.Name = "OptionsDialogSelectColorBtn";
    102       this.OptionsDialogSelectColorBtn.Size = new System.Drawing.Size(50, 23);
    103       this.OptionsDialogSelectColorBtn.TabIndex = 7;
    104       this.OptionsDialogSelectColorBtn.Text = "Select";
    105       this.OptionsDialogSelectColorBtn.UseVisualStyleBackColor = true;
    106       this.OptionsDialogSelectColorBtn.Click += new System.EventHandler(this.OptionsDialogSelectColorBtn_Click);
    107       //
    108       // ColorPreviewTB
    109       //
    110       this.ColorPreviewTB.Location = new System.Drawing.Point(146, 127);
    111       this.ColorPreviewTB.Name = "ColorPreviewTB";
    112       this.ColorPreviewTB.ReadOnly = true;
    113       this.ColorPreviewTB.Size = new System.Drawing.Size(64, 20);
    114       this.ColorPreviewTB.TabIndex = 6;
    115       //
    11699      // label2
    117100      //
     
    154137      // groupBox1
    155138      //
     139      this.groupBox1.Controls.Add(this.selectedLineColorSelection);
    156140      this.groupBox1.Controls.Add(this.MarkercheckBox);
    157141      this.groupBox1.Controls.Add(this.label4);
     
    287271      // tpXAxis
    288272      //
    289       this.tpXAxis.Controls.Add(this.chkShowXAxisGrid);
     273      this.tpXAxis.Controls.Add(this.groupBox2);
    290274      this.tpXAxis.Controls.Add(this.btnChangeXAxisFont);
    291275      this.tpXAxis.Location = new System.Drawing.Point(4, 22);
     
    295279      this.tpXAxis.Text = "X-Axis";
    296280      this.tpXAxis.UseVisualStyleBackColor = true;
     281      //
     282      // chkShowXAxisGrid
     283      //
     284      this.chkShowXAxisGrid.AutoSize = true;
     285      this.chkShowXAxisGrid.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
     286      this.chkShowXAxisGrid.Location = new System.Drawing.Point(20, 28);
     287      this.chkShowXAxisGrid.Name = "chkShowXAxisGrid";
     288      this.chkShowXAxisGrid.Size = new System.Drawing.Size(56, 17);
     289      this.chkShowXAxisGrid.TabIndex = 3;
     290      this.chkShowXAxisGrid.Text = "Visible";
     291      this.chkShowXAxisGrid.UseVisualStyleBackColor = true;
     292      this.chkShowXAxisGrid.CheckedChanged += new System.EventHandler(this.chkShowXAxisGrid_CheckedChanged);
    297293      //
    298294      // btnChangeXAxisFont
     
    360356      this.flpShowYAxis.TabIndex = 0;
    361357      //
    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);
     358      // label6
     359      //
     360      this.label6.AutoSize = true;
     361      this.label6.Location = new System.Drawing.Point(20, 55);
     362      this.label6.Name = "label6";
     363      this.label6.Size = new System.Drawing.Size(31, 13);
     364      this.label6.TabIndex = 5;
     365      this.label6.Text = "Color";
     366      //
     367      // groupBox2
     368      //
     369      this.groupBox2.Controls.Add(this.label6);
     370      this.groupBox2.Controls.Add(this.xAxisGridColorSelection);
     371      this.groupBox2.Controls.Add(this.chkShowXAxisGrid);
     372      this.groupBox2.Location = new System.Drawing.Point(8, 42);
     373      this.groupBox2.Name = "groupBox2";
     374      this.groupBox2.Size = new System.Drawing.Size(205, 94);
     375      this.groupBox2.TabIndex = 6;
     376      this.groupBox2.TabStop = false;
     377      this.groupBox2.Text = "Grid";
     378      //
     379      // selectedLineColorSelection
     380      //
     381      this.selectedLineColorSelection.Color = System.Drawing.SystemColors.Control;
     382      this.selectedLineColorSelection.Location = new System.Drawing.Point(142, 73);
     383      this.selectedLineColorSelection.Name = "selectedLineColorSelection";
     384      this.selectedLineColorSelection.Size = new System.Drawing.Size(121, 25);
     385      this.selectedLineColorSelection.TabIndex = 10;
     386      this.selectedLineColorSelection.ColorChanged += new HeuristicLab.Visualization.Options.ColorChangedHandler(this.selectedLineColorSelection_ColorChanged);
     387      //
     388      // xAxisGridColorSelection
     389      //
     390      this.xAxisGridColorSelection.Color = System.Drawing.SystemColors.Control;
     391      this.xAxisGridColorSelection.Location = new System.Drawing.Point(54, 49);
     392      this.xAxisGridColorSelection.Name = "xAxisGridColorSelection";
     393      this.xAxisGridColorSelection.Size = new System.Drawing.Size(126, 25);
     394      this.xAxisGridColorSelection.TabIndex = 4;
     395      this.xAxisGridColorSelection.ColorChanged += new HeuristicLab.Visualization.Options.ColorChangedHandler(this.xAxisGridColorSelection_ColorChanged);
    372396      //
    373397      // Options
     
    389413      this.tpTitle.PerformLayout();
    390414      this.tpXAxis.ResumeLayout(false);
    391       this.tpXAxis.PerformLayout();
    392415      this.tpYAxes.ResumeLayout(false);
    393416      this.tpYAxes.PerformLayout();
     
    396419      this.gbxShowYAxis.ResumeLayout(false);
    397420      this.gbxShowYAxis.PerformLayout();
     421      this.groupBox2.ResumeLayout(false);
     422      this.groupBox2.PerformLayout();
    398423      this.ResumeLayout(false);
    399424
     
    404429    private System.Windows.Forms.TabControl Optionstabs;
    405430    private System.Windows.Forms.TabPage tabPage1;
    406     private System.Windows.Forms.Button OptionsDialogSelectColorBtn;
    407     private System.Windows.Forms.TextBox ColorPreviewTB;
    408431    private System.Windows.Forms.Label label2;
    409432    private System.Windows.Forms.ComboBox LinestyleCB;
     
    432455    private System.Windows.Forms.TextBox tbxTitle;
    433456    private System.Windows.Forms.Label label5;
     457    private ColorSelection selectedLineColorSelection;
     458    private System.Windows.Forms.GroupBox groupBox2;
     459    private System.Windows.Forms.Label label6;
     460    private ColorSelection xAxisGridColorSelection;
    434461  }
    435462}
  • trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.cs

    r1881 r1885  
    1414    private Dictionary<CheckBox, bool> ShowYAxisBoxes;
    1515    private bool oldShowXAxisGrid;
     16    private Color oldXAxisGridColor;
    1617    private Dictionary<CheckBox, bool> yAxisClipChangeableBoxes;
    1718
     
    6768    public void ResetSettings() {
    6869      model.XAxis.ShowGrid = oldShowXAxisGrid;
     70      chkShowXAxisGrid.Checked = oldShowXAxisGrid;
     71     
     72      model.XAxis.GridColor = oldXAxisGridColor;
     73      xAxisGridColorSelection.Color = oldXAxisGridColor;
    6974
    7075      foreach (var param in oldLineParams) {
     
    95100    }
    96101
    97     private void OptionsDialogSelectColorBtn_Click(object sender, EventArgs e) {
    98       ColorDialog dlg = new ColorDialog();
    99       dlg.ShowDialog();
    100       ColorPreviewTB.BackColor = dlg.Color;
    101       ((IDataRow)LineSelectCB.SelectedValue).Color = dlg.Color;
    102     }
    103 
    104102    private static IList<int> GetThicknesses() {
    105103      return new List<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8});
     
    155153      oldShowXAxisGrid = model.XAxis.ShowGrid;
    156154      chkShowXAxisGrid.Checked = model.XAxis.ShowGrid;
     155
     156      oldXAxisGridColor = model.XAxis.GridColor;
     157      xAxisGridColorSelection.Color = model.XAxis.GridColor;
    157158
    158159      InitTabPageLines();
     
    216217        LineThicknessCB.SelectedItem = ((IDataRow)LineSelectCB.SelectedValue).Thickness;
    217218        LinestyleCB.SelectedItem = ((IDataRow)LineSelectCB.SelectedValue).Style;
    218         ColorPreviewTB.BackColor = ((IDataRow)LineSelectCB.SelectedValue).Color;
     219        selectedLineColorSelection.Color = ((IDataRow)LineSelectCB.SelectedValue).Color;
    219220        MarkercheckBox.Checked = ((IDataRow)LineSelectCB.SelectedValue).ShowMarkers;
    220221      }
     
    252253      model.ViewSettings.UpdateView();
    253254    }
     255
     256    private void selectedLineColorSelection_ColorChanged(ColorSelection sender) {
     257      ((IDataRow)LineSelectCB.SelectedValue).Color = selectedLineColorSelection.Color;
     258    }
     259
     260    private void xAxisGridColorSelection_ColorChanged(ColorSelection sender) {
     261      model.XAxis.GridColor = xAxisGridColorSelection.Color;
     262    }
    254263  }
    255264}
  • trunk/sources/HeuristicLab.Visualization/3.2/XAxisDescriptor.cs

    r1881 r1885  
     1using System.Drawing;
    12using HeuristicLab.Visualization.LabelProvider;
    23
     
    89    private bool showLabel = true;
    910    private bool showGrid = true;
     11    private Color gridColor = Color.LightBlue;
    1012    private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##");
    1113
     
    4446    }
    4547
     48    public Color GridColor {
     49      get { return this.gridColor; }
     50      set {
     51        this.gridColor = value;
     52        FireXAxisDescriptorChanged();
     53      }
     54    }
     55
    4656    private void FireXAxisDescriptorChanged() {
    4757      if (XAxisDescriptorChanged != null)
Note: See TracChangeset for help on using the changeset viewer.