Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
BottomAxis Height
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Difference between @ and ...
by
DavidTh30
[
Today
at 07:58:00 am]
Is this safe, changing fr...
by
Thaddy
[
Today
at 07:27:57 am]
try/except error
by
Thaddy
[
Today
at 07:23:48 am]
How to connect to MariaDb...
by
Thaddy
[
Today
at 07:18:13 am]
docking IDE
by
kapibara
[
Today
at 04:20:33 am]
Many recent books on Laza...
by
Martin_fr
[
Today
at 12:16:01 am]
Isn’t this funny?
by
Joanna
[
Today
at 12:04:29 am]
Error when opening a proj...
by
Tomu
[July 15, 2026, 09:36:13 pm]
Slow app start on M5 MacB...
by
Thaddy
[July 15, 2026, 03:36:57 pm]
Solpage
by
munair
[July 15, 2026, 01:47:30 pm]
Need help with fphttpserv...
by
Thaddy
[July 15, 2026, 12:58:30 pm]
Freepascal
by
Thaddy
[July 15, 2026, 12:39:23 pm]
Lazarus interface to Rexx...
by
Thaddy
[July 15, 2026, 12:38:10 pm]
Parsing error?
by
Thaddy
[July 15, 2026, 12:02:02 pm]
is there PDS reader/expor...
by
cdbc
[July 15, 2026, 10:55:30 am]
Peculiarities in the EXE ...
by
marcov
[July 15, 2026, 09:57:51 am]
Conscious Artificial Inte...
by
schuler
[July 14, 2026, 11:40:27 pm]
Lazarus Bugfix Release 4....
by
Martin_fr
[July 14, 2026, 10:55:23 pm]
equivalent to C/C++ "offs...
by
Thaddy
[July 14, 2026, 07:37:23 pm]
LazSWatch - a serial port...
by
CM630
[July 14, 2026, 06:11:52 pm]
MarcoV, please contact. ...
by
jbthiel
[July 14, 2026, 05:35:26 pm]
lazbuild vs IDE: PPU chec...
by
Martin_fr
[July 14, 2026, 05:30:50 pm]
OpenDocument('Filename') ...
by
cdbc
[July 14, 2026, 12:45:35 pm]
TCollection wiki entry
by
Thaddy
[July 14, 2026, 10:56:03 am]
Install new .deb over exi...
by
Thaddy
[July 14, 2026, 07:16:45 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: BottomAxis Height (Read 1442 times)
kapibara
Hero Member
Posts: 663
BottomAxis Height
«
on:
December 10, 2023, 08:46:39 am »
Is it possible to get the height of a BottomAxis?
The idea is to show BottomAxis only for the bottom pane and not for panes above it. The
Axis height would be used to adjust the height of the panes so the chart in the bottom-most pane doesn't appear smaller than the others because the axis takes up some of the graphs space.
Logged
Lazarus trunk / fpc 3.3.1 / Kubuntu 24.04 - 64 bit
kapibara
Hero Member
Posts: 663
Re: BottomAxis Height
«
Reply #1 on:
December 12, 2023, 12:15:00 am »
Finding the size of the chart area (where series are plotted, excluding axises and margins) would also work.
TChartAxis and TChartAxisList has a public method named Measure, could that be used to find heights of parts of the chart?
Logged
Lazarus trunk / fpc 3.3.1 / Kubuntu 24.04 - 64 bit
wp
Hero Member
Posts: 13625
Re: BottomAxis Height
«
Reply #2 on:
December 12, 2023, 12:57:38 am »
You could use the Chart's ClipRect to determine the "plot area" (rectangle enclosed by the axes); however, it can change its value depending on context. I think it is a bit safer to query the chart's CurrentExtent and to convert the two corner points to image coordinates:
Code: Pascal
[Select]
[+]
[-]
function
CalcPlotArea
(
AChart
:
TChart
)
:
TRect
;
var
ext
:
TDoubleRect
;
// requries unit TAChartUtils;
P1
,
P2
:
TPoint
;
begin
ext
:
=
AChart
.
CurrentExtent
;
P1
:
=
AChart
.
GraphToImage
(
ext
.
a
)
;
// left/bottom corner
P2
:
=
AChart
.
GraphToImage
(
ext
.
b
)
;
// right/top corner
Result
:
=
Rect
(
P1
.
X
,
P2
.
Y
,
P2
.
X
,
P1
.
Y
)
;
end
;
But note that this calculation is only successful after the chart has been painted.
Logged
kapibara
Hero Member
Posts: 663
Re: BottomAxis Height
«
Reply #3 on:
December 12, 2023, 06:37:21 am »
Seems to work, thanks! Like you warned, I had to add Application.ProcessMessages before calling CalcPlotArea to avoid EChartError, "scaling not yet initialized".
Logged
Lazarus trunk / fpc 3.3.1 / Kubuntu 24.04 - 64 bit
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
BottomAxis Height
TinyPortal
© 2005-2018