Show dragmarks in Bar Chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SiA
Newbie
Newbie
Posts: 43
Joined: Wed Mar 10, 2004 5:00 am

Show dragmarks in Bar Chart

Post by SiA » Mon Oct 13, 2008 8:44 am

Dear TeeChart-Supports,

We faced up to a issues about show dragmarks in Bar Chart as below:
1. Before refresh chart, we backup all dragmarks(width, height, arrow from position)
2. After refresh chart, we restore these previous dragmarks as below:

with DragMarkInfo.Series.Marks.Positions.Position[PositionIndex] do
begin
Custom := True;
ArrowFrom.X := DragMarkInfo.Series.CalcXPos(PositionIndex);
ArrowFrom.Y := DragMarkInfo.Series.CalcYPos(PositionIndex);
ArrowTo.X := StrToInt(ArrowToXPositionArray[PositionIndex]);
ArrowTo.Y := StrToInt(ArrowToYPositionArray[PositionIndex]);
LeftTop.X := StrToInt(ArrowToXPositionArray[PositionIndex]) -
(StrToInt(WidthArrowArray[PositionIndex]) div 2);
LeftTop.Y := StrToInt(ArrowToYPositionArray[PositionIndex]) -
StrToInt(HeightArrowArray[PositionIndex]);
Width := StrToInt(WidthArrowArray[PositionIndex]);
Height := StrToInt(HeightArrowArray[PositionIndex]);
end;

Although, in Bar Chart the following code returned wrong position. The ArrowTo position drew at lefttop of Bar Series (not middle on top of Bar Seriese).
ArrowFrom.X := DragMarkInfo.Series.CalcXPos(PositionIndex);
ArrowFrom.Y := DragMarkInfo.Series.CalcYPos(PositionIndex);

Could you please tell me how to show dragmarks in correctly position (the same as when we choose show dragmarks on Bar Series - at middle on top of Bar Series)?

Thank in advances.
SIA.

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

Post by Narcís » Mon Oct 13, 2008 11:57 am

Hi SIA,

You can try centering arrows using this code:

Code: Select all

  ArrowFrom.X := DragMarkInfo.Series.CalcXPos(PositionIndex) + ((DragMarkInfo[0] as TBarSeries).BarWidth div 2);
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

Post Reply