Changeset 1461 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 03/27/09 18:21:22 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/Legend/LegendShape.cs
r1388 r1461 58 58 if (!row) { 59 59 CreateColumn(item, y); 60 y -= 15;60 y -= Font.Height; 61 61 } else { 62 62 if (rowCounter >= numberOfItemsPerRow) { 63 63 x = ClippingArea.X1; 64 y -= 25;64 y -= Font.Height+15; 65 65 rowCounter = 0; 66 66 } … … 90 90 } 91 91 } 92 return 25*rowsToDraw;92 return (Font.Height+12)*rowsToDraw; 93 93 } 94 94 … … 109 109 /// <param name="item"></param> 110 110 /// <returns></returns> 111 private staticint GetLabelLengthInPixel(LegendItem item) {112 int dummy = item.Label.Length*6 + 20;111 private int GetLabelLengthInPixel(LegendItem item) { 112 int dummy = (int)(item.Label.Length*Font.Size + 20); 113 113 if (dummy < LegendItem.WIDTH) { 114 114 return LegendItem.WIDTH; … … 124 124 /// <param name="y">y axis to draw the item</param> 125 125 private void CreateRow(LegendItem item, double x, double y) { 126 AddShape(new LineShape(x, y - 5, x + 20, y - 5, item.Color, item.Thickness, DrawingStyle.Solid));126 AddShape(new LineShape(x, y - (Font.Height / 2), x + 20, y - (Font.Height / 2), item.Color, item.Thickness, DrawingStyle.Solid)); 127 127 AddShape(new TextShape(x + 25, y, item.Label, Font, Color)); 128 128 } … … 134 134 /// <param name="y">y axis to draw the item</param> 135 135 private void CreateColumn(LegendItem item, double y) { 136 AddShape(new LineShape(10, y - 10, 30, y - 10, item.Color, item.Thickness, DrawingStyle.Solid));137 AddShape(new TextShape( 35, y, item.Label, Font, Color));136 AddShape(new LineShape(10, y - (Font.Height / 2), 30, y - (Font.Height / 2), item.Color, item.Thickness, DrawingStyle.Solid)); 137 AddShape(new TextShape(Font.Height+12, y, item.Label, Font, Color)); 138 138 } 139 139 … … 147 147 148 148 /// <summary> 149 /// searches the longest label and returns it with the factor 6149 /// searches the longest label and returns it with factor of the the current font size 150 150 /// useful to set the width of the legend 151 151 /// </summary> 152 /// <returns>max label length with factor 6</returns>152 /// <returns>max label length with factor of the current font size</returns> 153 153 public int GetMaxLabelLength() { 154 154 int maxLabelLength = 0; … … 160 160 } 161 161 } 162 maxLabelLength = maxLabelLength*6;162 maxLabelLength = (int)(maxLabelLength*Font.Size); 163 163 } 164 164 return maxLabelLength < LegendItem.WIDTH ? LegendItem.WIDTH : maxLabelLength;
Note: See TracChangeset
for help on using the changeset viewer.