Position (TPoint) of the top of a stacked TBarSeries

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Test Always
Newbie
Newbie
Posts: 6
Joined: Thu Mar 14, 2013 12:00 am

Position (TPoint) of the top of a stacked TBarSeries

Post by Test Always » Fri Jun 28, 2013 7:26 pm

Given the X index of a stacked bar, I need to place the cursor at the top of bars. I have the following code:

Code: Select all

begin
  lPt.X := Chart1.BottomAxis.CalcXPosValue(spnXPos.EditingValue);
  lPt.Y := Chart1.LeftAxis.CalcYPosValue(Chart1.LeftAxis.Maximum);
  lPt := ClientToSCreen(lPt);
  SetCursorPos(lPt.X, lPt.Y);
end;
The X position is correct, my Y position is wrong. The Y is at the maximum of the axis--I want the maximum of the stacked bar position.

How can I find the maximum Y value of a stack of bars for a given index?

Ed Dressel

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Position (TPoint) of the top of a stacked TBarSeries

Post by Yeray » Mon Jul 01, 2013 1:42 pm

Hi Ed,

if you know Series and the ValueIndex to retrieve the position, you can just use the series CalcXPos/CalcYPos functions:

Code: Select all

  lPt.X:=Series.CalcXPos(ValueIndex);
  lPt.Y:=Series.CalcYPos(ValueIndex);
  lPt := Chart1.ClientToSCreen(lPt);
  SetCursorPos(lPt.X, lPt.Y);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply