Page 1 of 1

Setting triangle vertical alignment of TPointSeries Marks

Posted: Sun Jun 21, 2009 12:41 pm
by 10550741
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

Re: Setting triangle vertical alignment of TPointSeries Marks

Posted: Mon Jun 22, 2009 2:55 pm
by narcis
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!

Re: Setting triangle vertical alignment of TPointSeries Marks

Posted: Mon Jun 22, 2009 3:03 pm
by 10550741
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