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
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Interesting article about...
by
440bx
[
Today
at 09:17:06 am]
how to control the order ...
by
cdbc
[
Today
at 08:44:16 am]
SQLite3 Date Problem
by
egsuh
[
Today
at 06:29:10 am]
D2Bridge Framework for La...
by
egsuh
[
Today
at 04:48:02 am]
Application deployment
by
cousinp
[
Today
at 04:28:36 am]
[SOLVED] FPSpreadSheet, ...
by
TRon
[
Today
at 01:25:51 am]
Is it possible to do git ...
by
TRon
[
Today
at 12:41:39 am]
had a question and found ...
by
TRon
[
Today
at 12:36:57 am]
Draw Transparent Fill Rec...
by
LBox
[
Today
at 12:00:51 am]
Wiki, a dead link in page...
by
d7_2_laz
[December 09, 2024, 10:53:21 pm]
MIDI commands
by
TRon
[December 09, 2024, 10:43:22 pm]
Record "inheritance"/stru...
by
PascalDragon
[December 09, 2024, 10:31:25 pm]
Who catches the Linux sig...
by
LV
[December 09, 2024, 09:47:15 pm]
FreePascal version of gcc...
by
PascalDragon
[December 09, 2024, 09:45:02 pm]
Lazarus for Windows on aa...
by
PascalDragon
[December 09, 2024, 09:21:38 pm]
SAVE StringGrid to PDF
by
dseligo
[December 09, 2024, 07:42:30 pm]
ColorDialog can have opti...
by
Bart
[December 09, 2024, 06:07:24 pm]
Hustle - A simple task ma...
by
BSaidus
[December 09, 2024, 04:58:15 pm]
Notepad++ plugin with doc...
by
d7_2_laz
[December 09, 2024, 04:07:14 pm]
TLazSerial : serial port ...
by
CM630
[December 09, 2024, 04:05:20 pm]
MainMenu: How to use the ...
by
madref
[December 09, 2024, 03:39:05 pm]
Program running on after ...
by
MarkMLl
[December 09, 2024, 03:23:45 pm]
Array of String lookup gi...
by
jcmontherock
[December 09, 2024, 11:50:47 am]
The Silver Coder on YouTu...
by
silvercoder70
[December 09, 2024, 11:49:09 am]
Api/component pack for Ra...
by
cdbc
[December 09, 2024, 11:43:17 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: BottomAxis Height (Read 1002 times)
kapibara
Hero Member
Posts: 629
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 22.04 - 64 bit
kapibara
Hero Member
Posts: 629
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 22.04 - 64 bit
wp
Hero Member
Posts: 12464
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: 629
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 22.04 - 64 bit
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
BottomAxis Height
TinyPortal
© 2005-2018