Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/13/09 19:28:05 (16 years ago)
Author:
shofstad
Message:

Legend implementation updated with position setting (#407)

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

Legend:

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

    r1343 r1345  
    7272      xAxis.Color = viewSettings.XAxisColor;
    7373
    74       switch (viewSettings.LegendPosition) {
    75           case LegendPosition.Bottom:
    76             setLegendBottom();
    77             break;
    78 
    79           case LegendPosition.Top:
    80             setLegendTop();
    81             break;
    82 
    83           case LegendPosition.Left:
    84             setLegendLeft();
    85             break;
    86 
    87           case LegendPosition.Right:
    88             setLegendRight();
    89             break;
    90       }
     74      SetLegendPosition();
    9175
    9276      canvasUI.Invalidate();
     
    155139                                         linesAreaBoundingBox.Y1);
    156140
    157       setLegendBottom();
     141      SetLegendPosition();
     142    }
     143
     144    private void SetLegendPosition() {
     145      switch (viewSettings.LegendPosition) {
     146        case LegendPosition.Bottom:
     147          setLegendBottom();
     148          break;
     149
     150        case LegendPosition.Top:
     151          setLegendTop();
     152          break;
     153
     154        case LegendPosition.Left:
     155          setLegendLeft();
     156          break;
     157
     158        case LegendPosition.Right:
     159          setLegendRight();
     160          break;
     161      }
    158162    }
    159163
  • trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.Designer.cs

    r1343 r1345  
    149149      this.cbLegendPosition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    150150      this.cbLegendPosition.FormattingEnabled = true;
    151       this.cbLegendPosition.Items.AddRange(new object[] {
    152             "left",
    153             "right",
    154             "top",
    155             "bottom"});
    156151      this.cbLegendPosition.Location = new System.Drawing.Point(96, 35);
    157152      this.cbLegendPosition.Name = "cbLegendPosition";
  • trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs

    r1343 r1345  
    1414      this.model = model;
    1515      viewSettings = model.ViewSettings;
     16
     17      cbLegendPosition.Items.Add(LegendPosition.Top);
     18      cbLegendPosition.Items.Add(LegendPosition.Bottom);
     19      cbLegendPosition.Items.Add(LegendPosition.Left);
     20      cbLegendPosition.Items.Add(LegendPosition.Right);
     21
     22      cbLegendPosition.SelectedItem = viewSettings.LegendPosition;
    1623    }
    1724
     
    9198
    9299    private void cbLegendPosition_SelectedIndexChanged(object sender, EventArgs e) {
    93       string pos = cbLegendPosition.SelectedItem.ToString();
    94       if (pos.Equals("left")) {
    95         viewSettings.LegendPosition = LegendPosition.Left;
    96       } else if (pos.Equals("right")) {
    97         viewSettings.LegendPosition = LegendPosition.Right;
    98       } else if (pos.Equals("bottom")) {
    99         viewSettings.LegendPosition = LegendPosition.Bottom;
    100       } else {
    101         viewSettings.LegendPosition = LegendPosition.Top;
    102       }
    103      
     100      viewSettings.LegendPosition = (LegendPosition)cbLegendPosition.SelectedItem;
    104101      viewSettings.UpdateView();
    105102    }
Note: See TracChangeset for help on using the changeset viewer.