[Lazarus] Hint as text over TAChart

"Leonardo M. Ramé" l.rame at griensu.com
Sun Sep 21 13:59:40 CEST 2014


On 21/09/14 07:25, Werner Pamler wrote:
> 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.
>

Great!, I used the onAfterDrawBackwll's rect.


-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com




More information about the Lazarus mailing list