Page 1 of 1

Show dragmarks in Bar Chart

Posted: Mon Oct 13, 2008 8:44 am
by 9336299
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.

Posted: Mon Oct 13, 2008 11:57 am
by narcis
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!