[Lazarus] Hint as text over TAChart
Werner Pamler
werner.pamler at freenet.de
Sun Sep 21 12:25:41 CEST 2014
The most general way: Use the CurrentExtent of the chart, it is in
"graph coorinates", though, and you have to convert it to pixels yourself:
uses
TAChartUtils;
procedure TForm1.Button1Click(Sender: TObject);
var
ext: TDoubleRect;
begin
ext := Chart1.CurrentExtent;
Label1.Caption := Format('Left = %d, Top = %d, Right = %d, Bottom =
%d', [
Chart1.XGraphToImage(ext.a.x), // "a" is the lower left corner
Chart1.YGraphToImage(ext.b.y), // "b" is the upper right corner
Chart1.XGraphToImage(ext.b.x),
Chart1.YGraphtoImage(ext.a.y)
]);
end;
Or you could catch one of the events OnBeforeDrawBackwall or
OnAfterDrawBackwall which are fired during the painting process and
contain the rectangle enclosed by the axis lines as a parameter; simply
store that Rect for later usage.
More information about the Lazarus
mailing list