Page 1 of 1

Obtaining X-value of left side of frame

Posted: Sat Sep 02, 2006 11:55 am
by 9531329
How can you obtain the X-value of the left side of the frame (or bottom axis) relative to the left side of the TChart control?

Need to keep a slider-like control aligned with the actual start of the plot when the size of the left axis changes.

Posted: Sat Sep 02, 2006 1:05 pm
by 9531329
Clarification:

I originally tried to use TChart1.axis.left.position. The problem was that when I added values to the series (which changed the width of the axis labels) and immediately tested .position it did not reflect the new width.

I moved my resizing code to the AfterDraw event and all is well. Maybe there is a more straight-forward way to determine the frame position?

Posted: Mon Sep 04, 2006 7:42 am
by narcis
Hi Chuck,

The bounding rectangle can be obtained via Axis Positions:

TChart.Axis.Left.Position,
TChart.Axis.Top.Position - TChart.Aspect.Height3D,

TChart.Axis.Right.Position + TChart.Aspect.Width3D,
TChart.Axis.Bottom.Position

If some values are still not updated you can make a call to TChart1.Environment.InternalRepaint. However be very careful where you add this because it could make your application fall into an endless loop.