Changeset 1877
- Timestamp:
- 05/23/09 08:38:37 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization/3.2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/3.2/Legend/LegendItem.cs
r1342 r1877 4 4 public class LegendItem { 5 5 6 // default width 7 // every legend under 100 gets the default width 6 8 public static readonly int WIDTH = 100; 7 9 10 /// <summary> 11 /// a legend item object with its properties 12 /// </summary> 13 /// <param name="label">the label of the legend</param> 14 /// <param name="color">the color of the legend line</param> 15 /// <param name="thickness">the thickness of the legend line</param> 8 16 public LegendItem(string label, Color color, int thickness) { 9 17 Label = label; -
trunk/sources/HeuristicLab.Visualization/3.2/Legend/LegendShape.cs
r1665 r1877 1 using System;2 1 using System.Collections.Generic; 3 2 using System.Drawing; … … 14 13 private readonly IList<LegendItem> legendItems = new List<LegendItem>(); 15 14 // legend draw default value: column 16 private bool row;17 private bool top;18 15 19 16 private Color color = Color.Blue; 20 17 private Font font = new Font("Arial", 8); 21 18 19 public bool Row { get; set; } 20 public bool Top { get; set; } 21 22 22 public LegendShape() { 23 23 CreateLegend(); 24 }25 26 public bool Row {27 set { row = value; }28 get { return row; }29 }30 31 public bool Top {32 set { top = value; }33 get { return top; }34 24 } 35 25 … … 47 37 double y = ClippingArea.Y2; 48 38 49 if ( row && !top) {39 if (Row && !Top) { 50 40 y = GetOptimalBottomHeight(); 51 41 } 52 42 int legendItemCounter = 1; 53 43 foreach (LegendItem item in legendItems) { 54 if (! row) {44 if (!Row) { 55 45 CreateColumn(item, y); 56 46 y -= Font.Height; … … 68 58 } 69 59 60 /// <summary> 61 /// calculates the optimal height, when the legend shall be draw at the bottom 62 /// </summary> 63 /// <returns>optimal bottom height</returns> 70 64 private double GetOptimalBottomHeight() { 71 65 int rowsToDraw = 1; … … 78 72 } 79 73 80 ///// <summary> 81 ///// returns the maximum number of items per row to paint 82 ///// </summary> 83 ///// <returns>number of items per row</returns> 84 //public int GetNrOfItemsPerRow() { 85 // double sum = 0; 86 // double caw = ClippingArea.Width; 87 // int items = 0; 88 // foreach (var item in legendItems) { 89 // sum += GetLabelLengthInPixel(item); 90 // if (sum < caw) { 91 // items++; 92 // } 93 // } 94 // if (items == 0) { 95 // items++; 96 // } 97 // return items; 98 //} 99 100 /// <summary> 101 /// returns the maximum number of items per row to paint 102 /// </summary> 103 /// <returns>number of items per row</returns> 74 /// <summary> 75 /// returns a boolean value, if the new legend item has to be paint in a 76 /// new row 77 /// </summary> 78 /// <returns> 79 /// true, draw legend item in a new row 80 /// false, draw the legend item in the current row 81 /// </returns> 104 82 private bool IsNewRow(int toCurrentItem) { 105 83 double sum = 0; … … 117 95 /// returns the length of the current legenditem in pixel 118 96 /// </summary> 119 /// <param name="item"> </param>120 /// <returns> </returns>97 /// <param name="item">legend item to calculate the length</param> 98 /// <returns>length of the legend item</returns> 121 99 private int GetLabelLengthInPixel(LegendItem item) { 122 100 int dummy = (int)(item.Label.Length*Font.Size + 20); … … 145 123 private void CreateColumn(LegendItem item, double y) { 146 124 AddShape(new LineShape(10, y - (Font.Height / 2), 30, y - (Font.Height / 2), item.Color, item.Thickness, DrawingStyle.Solid)); 147 AddShape(new TextShape( Font.Height+12, y, item.Label, Font, Color));125 AddShape(new TextShape(35, y, item.Label, Font, Color));//Font.Height+12 148 126 } 149 127 … … 158 136 /// <summary> 159 137 /// searches the longest label and returns it with factor of the the current font size 160 /// useful to set the width of the legend 138 /// useful to set the width of the legend area on the left or right side 161 139 /// </summary> 162 140 /// <returns>max label length with factor of the current font size</returns> -
trunk/sources/HeuristicLab.Visualization/3.2/Options/ViewSettings.cs
r1389 r1877 24 24 xAxisColor = Color.Blue; 25 25 26 legendPosition = LegendPosition. Bottom;26 legendPosition = LegendPosition.Right; 27 27 } 28 28
Note: See TracChangeset
for help on using the changeset viewer.