Changeset 1462
- Timestamp:
- 03/27/09 20:23:17 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs
r1458 r1462 70 70 f.ShowDialog(); 71 71 } 72 72 73 73 [Test] 74 74 public void TestAxes() { … … 82 82 YAxisDescriptor yaxis2 = new YAxisDescriptor(); 83 83 84 model.XAxisLabel = "X Axis"; 85 model.ShowXAxisLabel = true; 86 84 87 yaxis1.Label = "Y-Axis 1"; 88 yaxis1.ShowYAxisLabel = true; 89 yaxis1.Position = AxisPosition.Left; 90 yaxis1.ShowGrid = true; 91 yaxis1.GridColor = Color.Gray; 92 85 93 yaxis2.Label = "Y-Axis 2"; 86 87 yaxis1.Position = AxisPosition.Left; 94 yaxis2.ShowYAxisLabel = true; 88 95 yaxis2.Position = AxisPosition.Right; 89 90 yaxis1.ShowGrid = true;91 96 yaxis2.ShowGrid = false; 92 93 yaxis1.GridColor = Color.Gray;94 97 95 98 row1.Color = Color.Red; … … 108 111 row3.Label = "Die Blaue"; 109 112 row3.YAxis = yaxis2; 110 row3.YAxis.Label = "Die Blaue";111 113 112 114 model.AddDataRow(row1); 113 115 model.AddDataRow(row2); 114 116 model.AddDataRow(row3); 115 116 row1.YAxis.Label = "Rot und Grün";117 117 118 118 Random rand = new Random(42); -
trunk/sources/HeuristicLab.Visualization/ChartDataRowsModel.cs
r1387 r1462 15 15 public class ChartDataRowsModel : ChartDataModelBase, IChartDataRowsModel{ 16 16 private string title = "Title"; 17 //private string xAxisLabel; 17 private string xAxisLabel = ""; 18 private bool showXAxisLabel = true; 18 19 private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##"); 19 20 … … 59 60 } 60 61 } 61 //public string XAxisLabel { 62 // get { return xAxisLabel; } 63 // set { 64 // xAxisLabel = value; 65 // OnModelChanged(); 66 // } 67 //} 62 63 public string XAxisLabel { 64 get { return xAxisLabel; } 65 set { 66 xAxisLabel = value; 67 OnModelChanged(); 68 } 69 } 70 71 public bool ShowXAxisLabel { 72 get { return showXAxisLabel; } 73 set { 74 showXAxisLabel = value; 75 OnModelChanged(); 76 } 77 } 68 78 69 79 public override IView CreateView() { -
trunk/sources/HeuristicLab.Visualization/IChartDataRowsModel.cs
r1350 r1462 19 19 ViewSettings ViewSettings { get; set; } 20 20 21 string XAxisLabel { get; set; } 22 bool ShowXAxisLabel { get; set; } 23 21 24 event ModelChangedHandler ModelChanged; 22 25 event DataRowAddedHandler DataRowAdded; -
trunk/sources/HeuristicLab.Visualization/LineChart.cs
r1459 r1462 27 27 28 28 private const int YAxisWidth = 100; 29 private const int XAxisHeight = 20;29 private const int XAxisHeight = 40; 30 30 31 31 /// <summary> … … 95 95 } 96 96 97 xAxis.ShowLabel = model.ShowXAxisLabel; 98 xAxis.Label = model.XAxisLabel; 99 97 100 canvas.AddShape(xAxis); 98 101 … … 104 107 if (yAxisDescriptor.ShowYAxis) { 105 108 canvas.AddShape(info.YAxis); 109 info.YAxis.ShowLabel = yAxisDescriptor.ShowYAxisLabel; 110 info.YAxis.Label = yAxisDescriptor.Label; 106 111 info.YAxis.Position = yAxisDescriptor.Position; 107 112 switch (yAxisDescriptor.Position) { -
trunk/sources/HeuristicLab.Visualization/TextShape.cs
r1337 r1462 1 1 using System; 2 2 using System.Drawing; 3 using System.Drawing.Drawing2D; 3 4 4 5 namespace HeuristicLab.Visualization { … … 19 20 private double x; 20 21 private double y; 22 private float rotation = 0; 21 23 22 24 private AnchorPositionX anchorPositionX = AnchorPositionX.Left; … … 59 61 } 60 62 63 public float Rotation { 64 get { return rotation; } 65 set { rotation = value; } 66 } 67 61 68 public Color Color { 62 69 get { return color; } … … 87 94 int screenX = Transform.ToScreenX(x, Parent.Viewport, Parent.ClippingArea); 88 95 int screenY = Transform.ToScreenY(y, Parent.Viewport, Parent.ClippingArea); 96 int offsetX, offsetY; 89 97 90 98 SizeF size = graphics.MeasureString(text, font); … … 92 100 switch (AnchorPositionX) { 93 101 case AnchorPositionX.Left: 102 offsetX = 0; 94 103 break; 95 104 case AnchorPositionX.Middle: 96 screenX -=(int)(size.Width/2);105 offsetX = -(int)(size.Width/2); 97 106 break; 98 107 case AnchorPositionX.Right: 99 screenX -=(int)size.Width;108 offsetX = -(int)size.Width; 100 109 break; 101 110 default: … … 105 114 switch (AnchorPositionY) { 106 115 case AnchorPositionY.Top: 116 offsetY = 0; 107 117 break; 108 118 case AnchorPositionY.Middle: 109 screenY -=(int)(size.Height/2);119 offsetY = -(int)(size.Height/2); 110 120 break; 111 121 case AnchorPositionY.Bottom: 112 screenY -=(int)size.Height;122 offsetY = -(int)size.Height; 113 123 break; 114 124 default: … … 116 126 } 117 127 118 graphics.DrawString(text, font, brush, screenX, screenY); 128 GraphicsState gstate = graphics.Save(); 129 graphics.TranslateTransform(screenX, screenY, MatrixOrder.Append); 130 graphics.RotateTransform(rotation, MatrixOrder.Prepend); 131 graphics.DrawString(text, font, brush, offsetX, offsetY); 132 graphics.Restore(gstate); 119 133 } 120 134 -
trunk/sources/HeuristicLab.Visualization/XAxis.cs
r1337 r1462 10 10 private Color color = Color.Blue; 11 11 private Font font = new Font("Arial", 8); 12 private bool showLabel = true; 13 private string label = ""; 12 14 13 15 public ILabelProvider LabelProvider { … … 22 24 ClippingArea.Width, 23 25 ClippingArea.X1)) { 24 TextShape label = new TextShape(x, ClippingArea.Height - 3,26 TextShape tickLabel = new TextShape(x, ClippingArea.Height - 3, 25 27 labelProvider.GetLabel(x), Font, Color); 28 tickLabel.AnchorPositionX = AnchorPositionX.Middle; 29 tickLabel.AnchorPositionY = AnchorPositionY.Top; 30 AddShape(tickLabel); 31 } 32 33 if (showLabel) { 34 TextShape label = new TextShape(ClippingArea.X1 + ClippingArea.Width/2, 35 ClippingArea.Y1 + 3, 36 this.label); 26 37 label.AnchorPositionX = AnchorPositionX.Middle; 27 label.AnchorPositionY = AnchorPositionY.Top; 38 label.AnchorPositionY = AnchorPositionY.Bottom; 39 28 40 AddShape(label); 29 41 } … … 41 53 set { font = value; } 42 54 } 55 56 public bool ShowLabel { 57 get { return showLabel; } 58 set { showLabel = value; } 59 } 60 61 public string Label { 62 get { return label; } 63 set { label = value; } 64 } 43 65 } 44 66 } -
trunk/sources/HeuristicLab.Visualization/YAxis.cs
r1457 r1462 10 10 private ILabelProvider labelProvider = new ContinuousLabelProvider("e4"); 11 11 private AxisPosition position = AxisPosition.Left; 12 private bool showLabel = true; 13 private string label = ""; 12 14 13 15 public ILabelProvider LabelProvider { … … 19 21 get { return position; } 20 22 set { position = value; } 23 } 24 25 public bool ShowLabel { 26 get { return showLabel; } 27 set { showLabel = value; } 28 } 29 30 public string Label { 31 get { return label; } 32 set { label = value; } 21 33 } 22 34 … … 43 55 } 44 56 45 TextShape label = new TextShape(x, y, labelProvider.GetLabel(y)); 46 label.AnchorPositionX = anchorPositionX; 47 label.AnchorPositionY = AnchorPositionY.Middle; 57 TextShape tickLabel = new TextShape(x, y, labelProvider.GetLabel(y)); 58 tickLabel.AnchorPositionX = anchorPositionX; 59 tickLabel.AnchorPositionY = AnchorPositionY.Middle; 60 AddShape(tickLabel); 61 } 62 63 if (showLabel) { 64 double x; 65 AnchorPositionY anchorPositionY; 66 67 switch (position) { 68 case AxisPosition.Left: 69 x = ClippingArea.X1 + 3; 70 anchorPositionY = AnchorPositionY.Top; 71 break; 72 case AxisPosition.Right: 73 x = ClippingArea.X2 - 3; 74 anchorPositionY = AnchorPositionY.Bottom; 75 break; 76 default: 77 throw new NotImplementedException(); 78 } 79 80 TextShape label = new TextShape(x, 81 ClippingArea.Y1 + ClippingArea.Height/2, 82 this.label); 83 label.AnchorPositionX = AnchorPositionX.Middle; 84 label.AnchorPositionY = anchorPositionY; 85 label.Rotation = -90; 48 86 AddShape(label); 49 87 } -
trunk/sources/HeuristicLab.Visualization/YAxisDescriptor.cs
r1460 r1462 12 12 private readonly List<IDataRow> dataRows = new List<IDataRow>(); 13 13 private bool showYAxis = true; 14 private bool showYAxisLabel = true; 14 15 private string label = ""; 15 16 public bool clipChangeable = true; … … 35 36 set { 36 37 showYAxis = value; 38 OnYAxisDescriptorChanged(); 39 } 40 } 41 42 public bool ShowYAxisLabel { 43 get { return showYAxisLabel; } 44 set { 45 showYAxisLabel = value; 37 46 OnYAxisDescriptorChanged(); 38 47 }
Note: See TracChangeset
for help on using the changeset viewer.