Changeset 1195


Ignore:
Timestamp:
01/30/09 17:53:52 (13 years ago)
Author:
shofstad
Message:

Legend implementation changed (#407)

Location:
trunk/sources
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

    • Property svn:ignore
      •  

        old new  
        33HeuristicLab.resharper
        44HeuristicLab.resharper.user
         5HeuristicLab.4.1.resharper.user
  • trunk/sources/HeuristicLab.Visualization.Test/LegendForm.cs

    r1048 r1195  
    1414    private void CreateLegendShape() {
    1515      WorldShape mainShape = canvasUI.MainCanvas.WorldShape;
    16       LegendShape ls = new LegendShape(0, 0, 100, 100, 0, Color.White);
     16      LegendShape ls = new LegendShape();
    1717      ls.AddLegendItem(new LegendItem("test", Color.Black, 5));
    1818      ls.AddLegendItem(new LegendItem("test2", Color.Red, 5));
  • trunk/sources/HeuristicLab.Visualization/HeuristicLab.Visualization.csproj

    r1194 r1195  
    8787    <Compile Include="LabelProvider\ILabelProvider.cs" />
    8888    <Compile Include="IMouseEventListener.cs" />
    89     <Compile Include="OptionsDialog.cs">
     89    <Compile Include="Options\OptionsDialog.cs">
    9090      <SubType>Form</SubType>
    9191    </Compile>
    92     <Compile Include="OptionsDialog.Designer.cs">
     92    <Compile Include="Options\OptionsDialog.Designer.cs">
    9393      <DependentUpon>OptionsDialog.cs</DependentUpon>
    9494    </Compile>
     
    147147      <SubType>Designer</SubType>
    148148    </EmbeddedResource>
    149     <EmbeddedResource Include="OptionsDialog.resx">
     149    <EmbeddedResource Include="Options\OptionsDialog.resx">
    150150      <DependentUpon>OptionsDialog.cs</DependentUpon>
    151151    </EmbeddedResource>
  • trunk/sources/HeuristicLab.Visualization/LegendShape.cs

    r1049 r1195  
    1616
    1717
    18   public class LegendShape : CompositeShape {
    19     private RectangleD boundingBox;
    20     private Color color;
    21 
     18  public class LegendShape : WorldShape {
    2219    private readonly IList<LegendItem> legendItems = new List<LegendItem>();
    23 
    24     public LegendShape(double x1, double y1, double x2, double y2, double z, Color color) {
    25       boundingBox = new RectangleD(x1, y1, x2, y2);
    26       Z = z;
    27       this.color = color;
     20   
     21    public LegendShape() {
    2822      CreateLegend();
    2923    }
    3024
    31     public double Z { get; set; }
    32 
    33     public RectangleD BoundingBox {
    34       get { return boundingBox; }
    35       set { boundingBox = value; }
    36     }
    37 
    3825    public void CreateLegend() {
    39       double y = boundingBox.Y2;
     26      shapes.Clear();
     27      double y = BoundingBox.Y2;
    4028      foreach (LegendItem item in legendItems) {
    4129        AddShape(new LineShape(10, y - 10, 30, y - 10, 0, item.Color, item.Thickness, DrawingStyle.Solid));
  • trunk/sources/HeuristicLab.Visualization/LineChart.cs

    r1187 r1195  
    55using System.Windows.Forms;
    66using HeuristicLab.Core;
     7using HeuristicLab.Visualization.Options;
    78
    89namespace HeuristicLab.Visualization {
     
    5556      root.AddShape(linesShape);
    5657
    57       legendShape = new LegendShape(0, 0, 0, 0, 0, Color.Black);
    58       //legendShape.AddLegendItem(new LegendItem("test", Color.Red, 5));
    59       //legendShape.AddLegendItem(new LegendItem("test1", Color.Blue, 5));
    60       //legendShape.AddLegendItem(new LegendItem("test2", Color.Pink, 5));
    61       root.AddShape(legendShape);
    62 
    6358      xAxis = new XAxis();
    6459      root.AddShape(xAxis);
     
    7267      minMaxLineShape = new MinMaxLineShape(this.minDataValue, this.maxDataValue, 0, Color.Yellow, 4, DrawingStyle.Solid);
    7368      root.AddShape(minMaxLineShape);
     69
     70      legendShape = new LegendShape();
     71      root.AddShape(legendShape);
     72
    7473      canvas.MainCanvas.WorldShape = root;
    7574      canvas.Resize += delegate { UpdateLayout(); };
    76 
     75     
    7776      UpdateLayout();
    7877      maxDataRowCount = 0;
     
    117116
    118117      legendShape.BoundingBox = new RectangleD(10, 10, 110, canvas.Height - 50);
     118      legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width,
     119                                                legendShape.BoundingBox.Height);
    119120    }
    120121
Note: See TracChangeset for help on using the changeset viewer.