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
[SOLVED] GTK3 : Icons hav...
by
zeljko
[
Today
at 10:40:09 pm]
Debian releases a Gtk3 La...
by
zeljko
[
Today
at 10:32:15 pm]
Getting results from sql ...
by
CraigC
[
Today
at 10:00:24 pm]
add thumb up or like butt...
by
Martin_fr
[
Today
at 09:35:13 pm]
Problem with drawing orde...
by
wp
[
Today
at 06:26:27 pm]
TChart: Wrong default val...
by
wp
[
Today
at 06:22:26 pm]
Hello! Anything new?
by
simone
[
Today
at 05:47:57 pm]
LAMW Foreground service -...
by
Mongkey
[
Today
at 05:40:05 pm]
could Ardour's YTK be use...
by
Fred vS
[
Today
at 04:59:52 pm]
Any way to "embed" Window...
by
myisjwj
[
Today
at 02:50:41 pm]
mORMot again (HttpServer/...
by
ttomas
[
Today
at 12:45:49 pm]
Is it me or is there some...
by
Martin_fr
[
Today
at 11:48:04 am]
Exiting HeapTrace dump
by
jamie
[
Today
at 11:34:49 am]
CONCAT formula
by
Zvoni
[
Today
at 08:17:21 am]
emuloader: help to resurr...
by
arcadegamer
[March 15, 2026, 08:30:31 pm]
AutoSize TMemo.Height?
by
wp
[March 15, 2026, 05:55:05 pm]
Initialization & finaliza...
by
Martin_fr
[March 15, 2026, 05:24:36 pm]
Possible Enhancement to t...
by
jamie
[March 15, 2026, 04:10:38 pm]
lazarus 4.99 and missing ...
by
wp
[March 15, 2026, 03:11:43 pm]
Questions about TFuncSeri...
by
hedgehog
[March 15, 2026, 06:58:29 am]
CryptoLib4Pascal
by
Xor-el
[March 14, 2026, 06:17:32 pm]
Extended Module Player
by
Gigatron
[March 14, 2026, 05:32:06 pm]
[AGGPas] Difference betwe...
by
Roland57
[March 14, 2026, 04:36:02 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: BottomAxis Height (Read 1367 times)
kapibara
Hero Member
Posts: 656
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.2.2 / Kubuntu 24.04 - 64 bit
kapibara
Hero Member
Posts: 656
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.2.2 / Kubuntu 24.04 - 64 bit
wp
Hero Member
Posts: 13433
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: 656
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.2.2 / Kubuntu 24.04 - 64 bit
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
BottomAxis Height
TinyPortal
© 2005-2018