- Timestamp:
- 04/14/09 21:59:13 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs
r1530 r1559 2 2 using System.Collections.Generic; 3 3 using System.Drawing; 4 using System.Drawing.Drawing2D; 4 5 using System.Windows.Forms; 5 6 using HeuristicLab.Core; … … 391 392 LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], row.Color, row.Thickness, row.Style); 392 393 rowEntry.LinesShape.AddShape(lineShape); 393 } 394 rowEntry.LinesShape.AddMarkerShape(new MarkerShape(i-1,row[i-1],8,row.Color)); 395 } 396 if(row.Count>0) 397 rowEntry.LinesShape.AddMarkerShape(new MarkerShape((row.Count - 1), row[(row.Count - 1)], 8, row.Color)); 394 398 } 395 399 … … 405 409 row.Style); 406 410 rowEntry.LinesShape.AddShape(lineShape); 411 407 412 } else { 408 413 LineShape lineShape = rowEntry.LinesShape.GetShape(0); … … 411 416 } 412 417 } else { 413 if (index > rowEntry.LinesShape.Count + 1) { 418 if (index > rowEntry.LinesShape.Count + 1) { //MarkersShape is on position zero 414 419 throw new NotImplementedException(); 415 420 } … … 419 424 LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], row.Color, row.Thickness, row.Style); 420 425 rowEntry.LinesShape.AddShape(lineShape); 426 rowEntry.LinesShape.AddMarkerShape(new MarkerShape(index, row[index ], 8, row.Color)); 421 427 } 422 428 … … 424 430 if (index > 0) { 425 431 rowEntry.LinesShape.GetShape(index - 1).Y2 = value; 432 ((MarkerShape)rowEntry.LinesShape.markersShape.GetShape(index - 1)).Y = value; 426 433 } 427 434 … … 429 436 if (index > 0 && index < row.Count - 1) { 430 437 rowEntry.LinesShape.GetShape(index).Y1 = value; 438 ((MarkerShape)rowEntry.LinesShape.markersShape.GetShape(index)).Y = value; 431 439 } 432 440 } … … 583 591 584 592 private class LinesShape : WorldShape { 593 public readonly CompositeShape markersShape = new CompositeShape(); 594 585 595 public void UpdateStyle(IDataRow row) { 586 596 foreach (IShape shape in shapes) { … … 594 604 } 595 605 606 public override void Draw(Graphics graphics) { 607 GraphicsState gstate = graphics.Save(); 608 609 graphics.SetClip(Viewport); 610 foreach (IShape shape in shapes) { 611 // draw child shapes using our own clipping area 612 shape.Draw(graphics); 613 } 614 markersShape.Draw(graphics); 615 graphics.Restore(gstate); 616 } 617 618 public void AddMarkerShape(IShape shape) { 619 shape.Parent = this; 620 markersShape.AddShape(shape); 621 } 622 596 623 public int Count { 597 624 get { return shapes.Count; } … … 599 626 600 627 public LineShape GetShape(int index) { 601 return (LineShape)shapes[index]; 628 return (LineShape)shapes[index]; //shapes[0] is markersShape!! 602 629 } 603 630 } … … 610 637 public RowEntry(IDataRow dataRow) { 611 638 this.dataRow = dataRow; 639 linesShape.markersShape.Parent = linesShape; 612 640 } 613 641 … … 619 647 get { return linesShape; } 620 648 } 621 } 622 623 private class YAxisInfo { 649 650 public void hideMarkers() { 651 linesShape.markersShape.ShowChildShapes = false; 652 } 653 654 public void showMarkers() { 655 linesShape.markersShape.ShowChildShapes = true; 656 } 657 } 658 659 private class YAxisInfo { 624 660 private readonly Grid grid = new Grid(); 625 661 private readonly YAxis yAxis = new YAxis();
Note: See TracChangeset
for help on using the changeset viewer.