Using the mark strings to identify points in a TPointSeries works but I would like to make a small adjustment in their positions of the labels. The labels are a little too high - especially if I use a larger font. I would prefer the text to be centered vertically on each symbol.
Thanks,
Jim
Adjust positions of marks in a TPointSeries?
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Adjust positions of marks in a TPointSeries?
Hello Jim,
If you have the Series Marks set to transparent, you could always use instead custom text drawing e.g.
which gives you this:
If you have the Series Marks set to transparent, you could always use instead custom text drawing e.g.
Code: Select all
procedure TForm1.AfterDraw(Sender: TObject);
var t, w, h:Integer;
str: String;
begin
Chart1.Canvas.Font.Size:=12;
for t := 0 to Series1.Count do
begin
str:=FloatToStr(Series1.YValues[t]);
w:=Chart1.Canvas.TextWidth(str) div 2;
h:=(Chart1.Canvas.TextHeight(str) div 2) - (Series1.Pointer.VertSize div 2);
Chart1.Canvas.TextOut(Series1.CalcXPos(t) - w, Series1.CalcYPos(t) - h, str);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D := False;
Series1.FillSampleValues();
{Series1.Marks.Visible:=true;
Series1.Marks.Transparent:=true;
Series1.Marks.Font.Size:=16;}
Chart1.OnAfterDraw:=AfterDraw;
end;
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Adjust positions of marks in a TPointSeries?
Thanks, it looks like that might work - although more complex than just a position option for point markers. I will try it.
Jim
Jim
Re: Adjust positions of marks in a TPointSeries?
Hello,
If it fits your needs, a simpler alternative could be to just set a negative ArrowLength. Ie:
If it fits your needs, a simpler alternative could be to just set a negative ArrowLength. Ie:
Code: Select all
Chart1.View3D:=False;
Chart1.Legend.Visible:=False;
Series1.FillSampleValues(10);
Series1.Marks.Visible:=true;
Series1.Marks.Font.Size:=16;
Series1.Marks.Transparent:=True;
Series1.Marks.ArrowLength:=-Series1.Marks.Font.Size;
Series1.Marks.Arrow.Visible:=False;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |