Setting triangle vertical alignment of TPointSeries Marks

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Setting triangle vertical alignment of TPointSeries Marks

Post by Shimon » Sun Jun 21, 2009 12:41 pm

Image

In the image attached you can see up pointing rectangles (TPointSeries - Pointer.Style := psTriangle)

When I set the coordinate of the point to be X, Y when Y is the highest point of a candle I notice that the
half of the triangle is drawn on the candle, which is not what I wanted ...

It seems that I need one of the two options :

1 - Some form of vertical alignment of the marks instead of center to be up / down
2 - Some option to give a Y pixel offset in this case I would choose the size of triangle / 2

Please note that the solution must support change of zoom ... (the above suggested solutions should support that)

Thanks
Shimon

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Setting triangle vertical alignment of TPointSeries Marks

Post by Narcís » Mon Jun 22, 2009 2:55 pm

Hi Shimon,

In that case you can try doing something like this:

Code: Select all

procedure TForm4.Chart1AfterDraw(Sender: TObject);
var j: Integer;
    tmp: double;
begin
  tmp:=Chart1.Axes.Left.CalcPosPoint(Chart1.Axes.Left.IEndPos-Series2.Pointer.VertSize) -
        Chart1.Axes.Left.CalcPosPoint(Chart1.Axes.Left.IEndPos);

  Series2.Clear;
  for j := 0 to Series1.Count - 1 do
  begin
    Series2.AddXY(Series1.XValue[j], Series1.HighValues[j] + tmp/2);
  end;
end;

procedure TForm4.Chart1UndoZoom(Sender: TObject);
begin
  Chart1.Draw;
end;

procedure TForm4.Chart1Zoom(Sender: TObject);
begin
  Chart1.Draw;  
end;

procedure TForm4.FormCreate(Sender: TObject);
var i: integer;
begin
  Chart1.View3D:=false;

  for i := 0 to 10 do
    Series1.AddCandle(Now+i,5,5,1,1);

  Series2.Pointer.Style:=psTriangle;

  Chart1.Draw;
end;
Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Shimon
Newbie
Newbie
Posts: 22
Joined: Tue Nov 04, 2008 12:00 am

Re: Setting triangle vertical alignment of TPointSeries Marks

Post by Shimon » Mon Jun 22, 2009 3:03 pm

Thanks a lot for your response, I have just noticed that all I needed was change the z order (I accomplished that with ExchangeSeries) and
not vertical alignment.

Anyway - Thank you

Post Reply