Last change
on this file since 1366 was
1337,
checked in by bspisic, 16 years ago
|
#520 Implemented font changes of x-axis, legend and title
|
File size:
1.3 KB
|
Rev | Line | |
---|
[987] | 1 | using System.Drawing;
|
---|
[1194] | 2 | using HeuristicLab.Visualization.LabelProvider;
|
---|
[987] | 3 |
|
---|
[983] | 4 | namespace HeuristicLab.Visualization {
|
---|
[1038] | 5 | public class XAxis : WorldShape {
|
---|
[1182] | 6 | public const int PixelsPerInterval = 100;
|
---|
[1233] | 7 |
|
---|
[1194] | 8 | private ILabelProvider labelProvider = new ContinuousLabelProvider("0.####");
|
---|
[983] | 9 |
|
---|
[1337] | 10 | private Color color = Color.Blue;
|
---|
| 11 | private Font font = new Font("Arial", 8);
|
---|
| 12 |
|
---|
[1182] | 13 | public ILabelProvider LabelProvider {
|
---|
| 14 | get { return labelProvider; }
|
---|
| 15 | set { labelProvider = value; }
|
---|
[1038] | 16 | }
|
---|
[987] | 17 |
|
---|
[1240] | 18 | public override void Draw(Graphics graphics) {
|
---|
| 19 | ClearShapes();
|
---|
[987] | 20 |
|
---|
[1240] | 21 | foreach (double x in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Width,
|
---|
[1233] | 22 | ClippingArea.Width,
|
---|
| 23 | ClippingArea.X1)) {
|
---|
[1182] | 24 | TextShape label = new TextShape(x, ClippingArea.Height - 3,
|
---|
[1337] | 25 | labelProvider.GetLabel(x), Font, Color);
|
---|
[1182] | 26 | label.AnchorPositionX = AnchorPositionX.Middle;
|
---|
| 27 | label.AnchorPositionY = AnchorPositionY.Top;
|
---|
[1240] | 28 | AddShape(label);
|
---|
[987] | 29 | }
|
---|
[1038] | 30 |
|
---|
[1240] | 31 | base.Draw(graphics);
|
---|
[987] | 32 | }
|
---|
[1337] | 33 |
|
---|
| 34 | public Color Color {
|
---|
| 35 | get { return color; }
|
---|
| 36 | set { color = value; }
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | public Font Font {
|
---|
| 40 | get { return font; }
|
---|
| 41 | set { font = value; }
|
---|
| 42 | }
|
---|
[983] | 43 | }
|
---|
| 44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.