Changeset 1285 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 03/07/09 15:57:16 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/ChartDataRowsModel.cs
r1194 r1285 116 116 rows.Remove(row); 117 117 OnDataRowRemoved(row); 118 } 119 120 // TODO implement calculation of max data row values 121 public int MaxDataRowValues { 122 get { 123 int max = 0; 124 125 foreach (IDataRow row in rows) { 126 max = Math.Max(max, row.Count); 127 } 128 129 return max; 130 } 118 131 } 119 132 -
trunk/sources/HeuristicLab.Visualization/DataRow.cs
r1233 r1285 25 25 private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##"); 26 26 27 // TODO implement calculation of min and max values 28 private double minValue = double.MaxValue; 29 private double maxValue = double.MinValue; 30 27 31 public DataRowType LineType{ 28 32 get { return lineType; } … … 115 119 116 120 public void AddValue(double value) { 121 UpdateMinMaxValue(value); 122 117 123 dataRow.Add(value); 118 124 OnValueChanged(value, dataRow.Count - 1, Action.Added); … … 223 229 } 224 230 } 231 232 public double MinValue { 233 get { return minValue; } 234 } 235 236 public double MaxValue { 237 get { return maxValue; } 238 } 239 240 private void UpdateMinMaxValue(double value) { 241 maxValue = Math.Max(value, maxValue); 242 minValue = Math.Min(value, minValue); 243 } 225 244 } 226 245 } -
trunk/sources/HeuristicLab.Visualization/IChartDataRowsModel.cs
r1194 r1285 23 23 //void RemoveLabels(int index, int count); 24 24 25 int MaxDataRowValues { get; } 26 25 27 event ModelChangedHandler ModelChanged; 26 28 event DataRowAddedHandler DataRowAdded; -
trunk/sources/HeuristicLab.Visualization/IDataRow.cs
r1233 r1285 35 35 double this[int index] { get; set; } 36 36 37 double MinValue { get; } 38 double MaxValue { get; } 39 37 40 event ValuesChangedHandler ValuesChanged; 38 41 event ValueChangedHandler ValueChanged; -
trunk/sources/HeuristicLab.Visualization/LineChart.cs
r1283 r1285 12 12 private readonly Canvas canvas; 13 13 14 private int maxDataRowCount; 15 private double minDataValue; 16 private double maxDataValue; 17 18 private readonly TextShape titleShape; 19 private readonly LinesShape linesShape; 20 private readonly LegendShape legendShape; 21 22 private readonly XAxis xAxis; 23 private readonly YAxis yAxis; 24 private readonly Grid grid; 25 26 private readonly Stack<RectangleD> clippingAreaHistory = new Stack<RectangleD>(); 27 private readonly WorldShape userInteractionShape; 28 private readonly RectangleShape rectangleShape; 14 private readonly TextShape titleShape = new TextShape("Title"); 15 private readonly LegendShape legendShape = new LegendShape(); 16 private readonly XAxis xAxis = new XAxis(); 17 private readonly List<RowEntry> rowEntries = new List<RowEntry>(); 18 19 private readonly Dictionary<IDataRow, RowEntry> rowToRowEntry = new Dictionary<IDataRow, RowEntry>(); 20 21 // private readonly Stack<RectangleD> clippingAreaHistory = new Stack<RectangleD>(); 22 private readonly WorldShape userInteractionShape = new WorldShape(); 23 private readonly RectangleShape rectangleShape = new RectangleShape(0, 0, 0, 0, Color.FromArgb(50, 0, 0, 255)); 29 24 private IMouseEventListener mouseEventListener; 25 26 private const int YAxisWidth = 100; 27 private const int XAxisHeight = 20; 28 30 29 private bool zoomToFullView; 31 30 … … 48 47 canvas = canvasUI.Canvas; 49 48 50 grid = new Grid();51 canvas.AddShape(grid);52 53 linesShape = new LinesShape();54 canvas.AddShape(linesShape);55 56 xAxis = new XAxis();57 canvas.AddShape(xAxis);58 59 yAxis = new YAxis();60 canvas.AddShape(yAxis);61 62 titleShape = new TextShape(0, 0, model.Title, 15);63 canvas.AddShape(titleShape);64 65 // horizontalLineShape = new HorizontalLineShape(this.maxDataValue, Color.Yellow, 4, DrawingStyle.Solid);66 // root.AddShape(horizontalLineShape);67 68 legendShape = new LegendShape();69 canvas.AddShape(legendShape);70 71 userInteractionShape = new WorldShape();72 canvas.AddShape(userInteractionShape);73 74 rectangleShape = new RectangleShape(0, 0, 0, 0, Color.Blue);75 rectangleShape.Opacity = 50;76 77 maxDataRowCount = 0;78 49 this.model = model; 50 79 51 Item = model; 80 52 … … 82 54 canvasUI.Resize += delegate { UpdateLayout(); }; 83 55 84 //The whole data rows are shown per default 85 if (zoomToFullView) { 86 ZoomToFullView(); 87 } 56 ZoomToFullView(); 88 57 } 89 58 … … 92 61 /// </summary> 93 62 private void UpdateLayout() { 63 canvas.ClearShapes(); 64 65 foreach (RowEntry rowEntry in rowEntries) { 66 canvas.AddShape(rowEntry.Grid); 67 } 68 69 foreach (RowEntry rowEntry in rowEntries) { 70 canvas.AddShape(rowEntry.LinesShape); 71 } 72 73 canvas.AddShape(xAxis); 74 75 foreach (RowEntry rowEntry in rowEntries) { 76 canvas.AddShape(rowEntry.YAxis); 77 } 78 79 canvas.AddShape(titleShape); 80 canvas.AddShape(legendShape); 81 82 canvas.AddShape(userInteractionShape); 83 94 84 titleShape.X = 10; 95 85 titleShape.Y = canvasUI.Height - 10; 96 86 97 const int yAxisWidth = 100; 98 const int xAxisHeight = 20; 99 100 linesShape.BoundingBox = new RectangleD(yAxisWidth, 101 xAxisHeight, 102 canvasUI.Width, 103 canvasUI.Height); 104 105 userInteractionShape.BoundingBox = linesShape.BoundingBox; 87 int yAxesWidth = 0; 88 89 foreach (RowEntry rowEntry in rowEntries) { 90 if (rowEntry.YAxis.Visible) { 91 yAxesWidth += YAxisWidth; 92 } 93 } 94 95 RectangleD linesAreaBoundingBox = new RectangleD(yAxesWidth, 96 XAxisHeight, 97 canvasUI.Width, 98 canvasUI.Height); 99 100 foreach (RowEntry rowEntry in rowEntries) { 101 rowEntry.LinesShape.BoundingBox = linesAreaBoundingBox; 102 rowEntry.Grid.BoundingBox = linesAreaBoundingBox; 103 } 104 105 int yAxisLeft = 0; 106 foreach (RowEntry rowEntry in rowEntries) { 107 rowEntry.YAxis.BoundingBox = new RectangleD(yAxisLeft, 108 linesAreaBoundingBox.Y1, 109 yAxisLeft + YAxisWidth, 110 linesAreaBoundingBox.Y2); 111 yAxisLeft += YAxisWidth; 112 } 113 114 userInteractionShape.BoundingBox = linesAreaBoundingBox; 106 115 userInteractionShape.ClippingArea = new RectangleD(0, 0, userInteractionShape.BoundingBox.Width, userInteractionShape.BoundingBox.Height); 107 116 108 grid.BoundingBox = linesShape.BoundingBox; 109 110 111 yAxis.BoundingBox = new RectangleD(0, 112 linesShape.BoundingBox.Y1, 113 linesShape.BoundingBox.X1, 114 linesShape.BoundingBox.Y2); 115 116 xAxis.BoundingBox = new RectangleD(linesShape.BoundingBox.X1, 117 xAxis.BoundingBox = new RectangleD(linesAreaBoundingBox.X1, 117 118 0, 118 lines Shape.BoundingBox.X2,119 lines Shape.BoundingBox.Y1);119 linesAreaBoundingBox.X2, 120 linesAreaBoundingBox.Y1); 120 121 121 122 legendShape.BoundingBox = new RectangleD(10, 10, 110, canvasUI.Height - 50); 122 123 legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width, 123 124 legendShape.BoundingBox.Height); 125 126 canvasUI.Invalidate(); 124 127 } 125 128 … … 130 133 131 134 public void OnDataRowChanged(IDataRow row) { 132 foreach (LineShape ls in rowToLineShapes[row]) { 133 ls.LSColor = row.Color; 134 ls.LSThickness = row.Thickness; 135 ls.LSDrawingStyle = row.Style; 136 } 135 RowEntry rowEntry = rowToRowEntry[row]; 136 137 rowEntry.LinesShape.UpdateStyle(row); 138 137 139 canvasUI.Invalidate(); 138 140 } 139 141 140 142 #region Add-/RemoveItemEvents 141 142 private readonly IDictionary<IDataRow, List<LineShape>> rowToLineShapes =143 new Dictionary<IDataRow, List<LineShape>>();144 143 145 144 protected override void AddItemEvents() { … … 168 167 row.DataRowChanged += OnDataRowChanged; 169 168 170 if (row.Count > maxDataRowCount) {171 maxDataRowCount = row.Count;172 // UpdateSingleValueRows();173 }174 175 169 legendShape.AddLegendItem(new LegendItem(row.Label, row.Color, row.Thickness)); 176 170 legendShape.CreateLegend(); 171 177 172 InitLineShapes(row); 173 174 UpdateLayout(); 178 175 } 179 176 … … 182 179 row.ValuesChanged -= OnRowValuesChanged; 183 180 row.DataRowChanged -= OnDataRowChanged; 181 182 rowToRowEntry.Remove(row); 183 rowEntries.RemoveAll(delegate(RowEntry rowEntry) { return rowEntry.DataRow == row; }); 184 185 UpdateLayout(); 184 186 } 185 187 … … 187 189 188 190 public void ZoomToFullView() { 189 RectangleD newClippingArea = new RectangleD(-0.1, 190 minDataValue - ((maxDataValue - minDataValue)*0.05), 191 maxDataRowCount - 0.9, 192 maxDataValue + ((maxDataValue - minDataValue)*0.05)); 193 194 SetLineClippingArea(newClippingArea, true); 191 SetClipX(-0.1, model.MaxDataRowValues - 0.9); 192 193 foreach (RowEntry rowEntry in rowEntries) { 194 IDataRow row = rowEntry.DataRow; 195 196 SetClipY(rowEntry, 197 row.MinValue - ((row.MaxValue - row.MinValue)*0.05), 198 row.MaxValue + ((row.MaxValue - row.MinValue)*0.05)); 199 } 195 200 196 201 zoomToFullView = true; 197 } 198 199 /// <summary> 200 /// Sets the clipping area of the data to display. 201 /// </summary> 202 /// <param name="clippingArea"></param> 203 /// <param name="pushToHistoryStack"></param> 204 private void SetLineClippingArea(RectangleD clippingArea, bool pushToHistoryStack) { 205 zoomToFullView = false; 206 207 if (pushToHistoryStack) { 208 int count = clippingAreaHistory.Count; 209 210 if (count > 40) { 211 RectangleD[] clippingAreas = clippingAreaHistory.ToArray(); 212 clippingAreaHistory.Clear(); 213 214 for (int i = count - 20; i < count; i++) { 215 clippingAreaHistory.Push(clippingAreas[i]); 216 } 217 } 218 219 clippingAreaHistory.Push(clippingArea); 220 } 221 222 linesShape.ClippingArea = clippingArea; 223 224 grid.ClippingArea = linesShape.ClippingArea; 225 226 // horizontalLineShape.ClippingArea = linesShape.ClippingArea; 227 228 229 xAxis.ClippingArea = new RectangleD(linesShape.ClippingArea.X1, 230 xAxis.BoundingBox.Y1, 231 linesShape.ClippingArea.X2, 232 xAxis.BoundingBox.Y2); 233 234 yAxis.ClippingArea = new RectangleD(yAxis.BoundingBox.X1, 235 linesShape.ClippingArea.Y1, 236 yAxis.BoundingBox.X2, 237 linesShape.ClippingArea.Y2); 238 239 canvasUI.Invalidate(); 202 203 canvasUI.Invalidate(); 204 } 205 206 private void SetClipX(double x1, double x2) { 207 xAxis.ClippingArea = new RectangleD(x1, 208 0, 209 x2, 210 XAxisHeight); 211 212 foreach (RowEntry rowEntry in rowEntries) { 213 rowEntry.LinesShape.ClippingArea = new RectangleD(x1, 214 rowEntry.LinesShape.ClippingArea.Y1, 215 x2, 216 rowEntry.LinesShape.ClippingArea.Y2); 217 rowEntry.Grid.ClippingArea = new RectangleD(x1, 218 rowEntry.Grid.ClippingArea.Y1, 219 x2, 220 rowEntry.Grid.ClippingArea.Y2); 221 rowEntry.YAxis.ClippingArea = new RectangleD(0, 222 rowEntry.YAxis.ClippingArea.Y1, 223 YAxisWidth, 224 rowEntry.YAxis.ClippingArea.Y2); 225 } 226 } 227 228 private static void SetClipY(RowEntry rowEntry, double y1, double y2) { 229 rowEntry.LinesShape.ClippingArea = new RectangleD(rowEntry.LinesShape.ClippingArea.X1, 230 y1, 231 rowEntry.LinesShape.ClippingArea.X2, 232 y2); 233 rowEntry.Grid.ClippingArea = new RectangleD(rowEntry.Grid.ClippingArea.X1, 234 y1, 235 rowEntry.Grid.ClippingArea.X2, 236 y2); 237 rowEntry.YAxis.ClippingArea = new RectangleD(rowEntry.YAxis.ClippingArea.X1, 238 y1, 239 rowEntry.YAxis.ClippingArea.X2, 240 y2); 240 241 } 241 242 242 243 private void InitLineShapes(IDataRow row) { 243 List<LineShape> lineShapes = new List<LineShape>(); 244 if (rowToLineShapes.Count == 0) { 245 minDataValue = Double.PositiveInfinity; 246 maxDataValue = Double.NegativeInfinity; 247 } 248 if ((row.Count > 0)) { 249 maxDataValue = Math.Max(row[0], maxDataValue); 250 minDataValue = Math.Min(row[0], minDataValue); 251 } 244 RowEntry rowEntry = new RowEntry(row); 245 rowEntries.Add(rowEntry); 246 rowToRowEntry[row] = rowEntry; 247 252 248 if ((row.LineType == DataRowType.SingleValue)) { 253 249 if (row.Count > 0) { 254 250 LineShape lineShape = new HorizontalLineShape(0, row[0], double.MaxValue, row[0], row.Color, row.Thickness, 255 251 row.Style); 256 lineShapes.Add(lineShape); 257 // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently. 258 linesShape.AddShape(lineShape); 252 rowEntry.LinesShape.AddShape(lineShape); 259 253 } 260 254 } else { 261 255 for (int i = 1; i < row.Count; i++) { 262 256 LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], row.Color, row.Thickness, row.Style); 263 lineShapes.Add(lineShape); 264 // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently. 265 linesShape.AddShape(lineShape); 266 maxDataValue = Math.Max(row[i], maxDataValue); 267 minDataValue = Math.Min(row[i], minDataValue); 268 } 269 } 270 //horizontalLineShape.YVal = maxDataValue; 271 rowToLineShapes[row] = lineShapes; 257 rowEntry.LinesShape.AddShape(lineShape); 258 } 259 } 272 260 273 261 ZoomToFullView(); 274 262 } 275 263 276 // TODO use action parameter277 264 private void OnRowValueChanged(IDataRow row, double value, int index, Action action) { 278 List<LineShape> lineShapes = rowToLineShapes[row]; 279 maxDataValue = Math.Max(value, maxDataValue); 280 minDataValue = Math.Min(value, minDataValue); 265 RowEntry rowEntry = rowToRowEntry[row]; 266 281 267 if (row.LineType == DataRowType.SingleValue) { 282 268 if (action == Action.Added) { 283 269 LineShape lineShape = new HorizontalLineShape(0, row[0], double.MaxValue, row[0], row.Color, row.Thickness, 284 270 row.Style); 285 lineShapes.Add(lineShape); 286 // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently. 287 linesShape.AddShape(lineShape); 271 rowEntry.LinesShape.AddShape(lineShape); 288 272 } else { 289 // lineShapes[0].X2 = maxDataRowCount;290 lineShape s[0].Y1 = value;291 lineShape s[0].Y2 = value;273 LineShape lineShape = rowEntry.LinesShape.GetShape(0); 274 lineShape.Y1 = value; 275 lineShape.Y2 = value; 292 276 } 293 277 } else { 294 // horizontalLineShape.YVal = maxDataValue; 295 if (index > lineShapes.Count + 1) { 278 if (index > rowEntry.LinesShape.Count + 1) { 296 279 throw new NotImplementedException(); 297 280 } 298 281 299 282 // new value was added 300 if (index > 0 && index == lineShapes.Count + 1) { 301 if (maxDataRowCount < row.Count) { 302 maxDataRowCount = row.Count; 303 // UpdateSingleValueRows(); 304 } 305 LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], row.Color, row.Thickness, 306 row.Style); 307 lineShapes.Add(lineShape); 308 // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently. 309 linesShape.AddShape(lineShape); 283 if (index > 0 && index == rowEntry.LinesShape.Count + 1) { 284 LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], row.Color, row.Thickness, row.Style); 285 rowEntry.LinesShape.AddShape(lineShape); 310 286 } 311 287 312 288 // not the first value 313 289 if (index > 0) { 314 lineShapes[index - 1].Y2 = value;290 rowEntry.LinesShape.GetShape(index - 1).Y2 = value; 315 291 } 316 292 317 293 // not the last value 318 294 if (index > 0 && index < row.Count - 1) { 319 lineShapes[index].Y1 = value;295 rowEntry.LinesShape.GetShape(index).Y1 = value; 320 296 } 321 297 } … … 324 300 } 325 301 326 // TODO remove (see ticket #501)327 public IList<IDataRow> GetRows() {328 return model.Rows;329 }330 331 332 // TODO use action parameter333 302 private void OnRowValuesChanged(IDataRow row, double[] values, int index, Action action) { 334 303 foreach (double value in values) { … … 368 337 369 338 private void Pan(Point startPoint, Point endPoint) { 370 RectangleD clippingArea = CalcPanClippingArea(startPoint, endPoint); 371 SetLineClippingArea(clippingArea, false); 339 zoomToFullView = false; 340 341 foreach (RowEntry rowEntry in rowEntries) { 342 RectangleD clippingArea = CalcPanClippingArea(startPoint, endPoint, rowEntry.LinesShape); 343 344 SetClipX(clippingArea.X1, clippingArea.X1); 345 SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2); 346 } 347 348 canvasUI.Invalidate(); 372 349 } 373 350 374 351 private void PanEnd(Point startPoint, Point endPoint) { 375 RectangleD clippingArea = CalcPanClippingArea(startPoint, endPoint); 376 SetLineClippingArea(clippingArea, true); 377 } 378 379 private RectangleD CalcPanClippingArea(Point startPoint, Point endPoint) { 352 zoomToFullView = false; 353 354 foreach (RowEntry rowEntry in rowEntries) { 355 RectangleD clippingArea = CalcPanClippingArea(startPoint, endPoint, rowEntry.LinesShape); 356 357 SetClipX(clippingArea.X1, clippingArea.X1); 358 SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2); 359 } 360 361 canvasUI.Invalidate(); 362 } 363 364 private static RectangleD CalcPanClippingArea(Point startPoint, Point endPoint, LinesShape linesShape) { 380 365 return Translate.ClippingArea(startPoint, endPoint, linesShape.ClippingArea, linesShape.Viewport); 381 366 } 382 367 383 368 private void SetClippingArea(Rectangle rectangle) { 384 RectangleD clippingArea = Transform.ToWorld(rectangle, linesShape.Viewport, linesShape.ClippingArea); 385 386 SetLineClippingArea(clippingArea, true); 369 foreach (RowEntry rowEntry in rowEntries) { 370 RectangleD clippingArea = Transform.ToWorld(rectangle, rowEntry.LinesShape.Viewport, rowEntry.LinesShape.ClippingArea); 371 372 SetClipX(clippingArea.X1, clippingArea.X1); 373 SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2); 374 } 375 387 376 userInteractionShape.RemoveShape(rectangleShape); 377 canvasUI.Invalidate(); 388 378 } 389 379 … … 394 384 395 385 private void canvasUI1_KeyDown(object sender, KeyEventArgs e) { 396 if (e.KeyCode == Keys.Back && clippingAreaHistory.Count > 1) {397 clippingAreaHistory.Pop();398 399 RectangleD clippingArea = clippingAreaHistory.Peek();400 401 SetLineClippingArea(clippingArea, false);402 }386 // if (e.KeyCode == Keys.Back && clippingAreaHistory.Count > 1) { 387 // clippingAreaHistory.Pop(); 388 // 389 // RectangleD clippingArea = clippingAreaHistory.Peek(); 390 // 391 // SetLineClippingArea(clippingArea, false); 392 // } 403 393 } 404 394 … … 446 436 double zoomFactor = (e.Delta > 0) ? 0.9 : 1.1; 447 437 448 RectangleD clippingArea = ZoomListener.ZoomClippingArea(linesShape.ClippingArea, zoomFactor); 449 450 SetLineClippingArea(clippingArea, true); 438 foreach (RowEntry rowEntry in rowEntries) { 439 RectangleD clippingArea = ZoomListener.ZoomClippingArea(rowEntry.LinesShape.ClippingArea, zoomFactor); 440 441 SetClipX(clippingArea.X1, clippingArea.X1); 442 SetClipY(rowEntry, clippingArea.Y1, clippingArea.Y2); 443 } 451 444 } 452 445 } … … 454 447 #endregion 455 448 456 #region Nested type: LinesShape 457 458 internal class LinesShape : WorldShape {} 459 460 #endregion 449 private class LinesShape : WorldShape { 450 public void UpdateStyle(IDataRow row) { 451 foreach (IShape shape in shapes) { 452 LineShape lineShape = shape as LineShape; 453 if (lineShape != null) { 454 lineShape.LSColor = row.Color; 455 lineShape.LSDrawingStyle = row.Style; 456 lineShape.LSThickness = row.Thickness; 457 } 458 } 459 } 460 461 public int Count { 462 get { return shapes.Count; } 463 } 464 465 public LineShape GetShape(int index) { 466 return (LineShape)shapes[index]; 467 } 468 } 469 470 private class RowEntry { 471 private readonly IDataRow dataRow; 472 473 private readonly Grid grid = new Grid(); 474 private readonly YAxis yAxis = new YAxis(); 475 private readonly LinesShape linesShape = new LinesShape(); 476 477 public RowEntry(IDataRow dataRow) { 478 this.dataRow = dataRow; 479 } 480 481 public IDataRow DataRow { 482 get { return dataRow; } 483 } 484 485 public Grid Grid { 486 get { return grid; } 487 } 488 489 public YAxis YAxis { 490 get { return yAxis; } 491 } 492 493 public LinesShape LinesShape { 494 get { return linesShape; } 495 } 496 } 461 497 } 462 498 } -
trunk/sources/HeuristicLab.Visualization/TextShape.cs
r1240 r1285 22 22 private AnchorPositionX anchorPositionX = AnchorPositionX.Left; 23 23 private AnchorPositionY anchorPositionY = AnchorPositionY.Top; 24 25 public TextShape(string text) : this(0, 0, text, 14) {} 24 26 25 27 public TextShape(double x, double y, string text) : this(x, y, text, 8) {} -
trunk/sources/HeuristicLab.Visualization/WorldShape.cs
r1240 r1285 13 13 private IShape parent; 14 14 15 pr ivatereadonly List<IShape> shapes = new List<IShape>();15 protected readonly List<IShape> shapes = new List<IShape>(); 16 16 17 17 public WorldShape() { -
trunk/sources/HeuristicLab.Visualization/YAxis.cs
r1240 r1285 7 7 8 8 private ILabelProvider labelProvider = new ContinuousLabelProvider("e4"); 9 private bool visible = true; 9 10 10 11 public ILabelProvider LabelProvider { … … 13 14 } 14 15 16 public bool Visible { 17 get { return visible; } 18 set { visible = value; } 19 } 20 15 21 public override void Draw(Graphics graphics) { 16 22 ClearShapes(); 17 23 18 foreach (double y in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Height, 19 ClippingArea.Height, 20 ClippingArea.Y1)) { 21 TextShape label = new TextShape(ClippingArea.X2 - 3, y, 22 labelProvider.GetLabel(y)); 23 label.AnchorPositionX = AnchorPositionX.Right; 24 label.AnchorPositionY = AnchorPositionY.Middle; 25 AddShape(label); 24 if (Visible) { 25 foreach (double y in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Height, 26 ClippingArea.Height, 27 ClippingArea.Y1)) { 28 TextShape label = new TextShape(ClippingArea.X2 - 3, y, 29 labelProvider.GetLabel(y)); 30 label.AnchorPositionX = AnchorPositionX.Right; 31 label.AnchorPositionY = AnchorPositionY.Middle; 32 AddShape(label); 33 } 26 34 } 27 35
Note: See TracChangeset
for help on using the changeset viewer.