Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
[solved] TA Chart / BarSeries: Which setting will say "no data - no draw"?
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
Lazarus Blowfish
by
rvk
[
Today
at 05:17:17 pm]
AArch64. Slow program sta...
by
LemonParty
[
Today
at 04:46:31 pm]
Help with search and repa...
by
avk
[
Today
at 04:35:29 pm]
An Idea for a helpful uti...
by
Curt Carpenter
[
Today
at 04:33:20 pm]
[SOLVED] Heaptrc reports ...
by
BrunoK
[
Today
at 04:32:53 pm]
Info for PTCGraph users.....
by
Handoko
[
Today
at 04:01:45 pm]
Initialize list in functi...
by
PeterHu
[
Today
at 10:33:27 am]
Tips for cross-compiling ...
by
Seenkao
[
Today
at 09:25:29 am]
Drawing a picture on the ...
by
DMH
[
Today
at 05:01:07 am]
Anyone interested in help...
by
ad1mt
[November 09, 2025, 07:57:13 pm]
How detect a keypress in ...
by
Remy Lebeau
[November 09, 2025, 07:49:50 pm]
Paradox date filter
by
tawfiq-lz
[November 09, 2025, 07:46:20 pm]
Why is there no Chinese s...
by
Ten_Mile_Hike
[November 09, 2025, 06:55:11 pm]
Convert table to JSON arr...
by
paweld
[November 09, 2025, 05:56:56 pm]
Unexpected lack of error ...
by
n7800
[November 09, 2025, 05:39:10 pm]
FPC 3.2.4-rc1 available
by
pleumann
[November 09, 2025, 05:12:32 pm]
application crashes on st...
by
Thaddy
[November 09, 2025, 04:17:28 pm]
Blog area?
by
Martin_fr
[November 09, 2025, 02:00:17 pm]
SimpleXML
by
ednaldomoreira
[November 09, 2025, 01:45:18 pm]
What happens if you use "...
by
Thaddy
[November 09, 2025, 01:39:12 pm]
CustomDraw package compil...
by
lainz
[November 09, 2025, 01:21:58 pm]
Register global hotkey
by
Thaddy
[November 09, 2025, 12:46:46 pm]
How to port TArray.Sort?
by
Thaddy
[November 09, 2025, 12:20:36 pm]
Dynamic libraries in Linu...
by
Fred vS
[November 08, 2025, 10:28:42 pm]
FPC v3.2.2 internal error
by
440bx
[November 08, 2025, 09:15:48 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [solved] TA Chart / BarSeries: Which setting will say "no data - no draw"? (Read 1905 times)
Nicole
Hero Member
Posts: 1271
[solved] TA Chart / BarSeries: Which setting will say "no data - no draw"?
«
on:
June 21, 2023, 10:10:33 am »
I have a chart, in which I add data by code.
The x-axes holds dates.
Which setting will make that only those dates are drawn, where there are figures for?
Please see at the screenshot, how it looks and how I want it to look.
«
Last Edit: June 21, 2023, 02:24:17 pm by Nicole
»
Logged
wp
Hero Member
Posts: 13210
Re: TA Chart / BarSeries: Which setting will say "no data - no draw"?
«
Reply #1 on:
June 21, 2023, 10:59:30 am »
Do not assign an x value to the series; this way you use the equidistant point index --> Use Series.Add(y) rather than Series.AddXY(x, y). Convert the date to a string and apply is as additional parameter in the Add call:
Add(y, DateToStr(date)).
In order to get the dates to the horizontal axis you additionally must assign the ChartSource used by the series to the Source property of the BottomAxis.Marks. And you must also set BottomAxis.Marks.Style to smsLabel in order to see the labels defined by the Add calls:
Code: Pascal
[Select]
[+]
[-]
uses
TAChartUtils
;
procedure
TForm1
.
FormCreate
(
Sender
:
TObject
)
;
begin
Chart1BarSeries1
.
Add
(
Random
*
1000
,
DateToStr
(
EncodeDate
(
2000
,
1
,
1
)
)
)
;
Chart1BarSeries1
.
Add
(
Random
*
1000
,
DateToStr
(
EncodeDate
(
2020
,
1
,
1
)
)
)
;
Chart1BarSeries1
.
Add
(
Random
*
1000
,
DateToStr
(
EncodeDate
(
2022
,
1
,
1
)
)
)
;
Chart1BarSeries1
.
Add
(
Random
*
1000
,
DateToStr
(
EncodeDate
(
2022
,
6
,
21
)
)
)
;
Chart1
.
BottomAxis
.
Marks
.
Source
:
=
Chart1BarSeries1
.
Source
;
Chart1
.
BottomAxis
.
Marks
.
Style
:
=
smsLabel
;
end
;
«
Last Edit: June 21, 2023, 11:10:06 am by wp
»
Logged
Nicole
Hero Member
Posts: 1271
[solved] Re: TA Chart / BarSeries: Which setting will say "no data - no draw"?
«
Reply #2 on:
June 21, 2023, 02:23:57 pm »
This worked at sudden, thank you so much!
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
TAChart
(Moderator:
Ask
) »
[solved] TA Chart / BarSeries: Which setting will say "no data - no draw"?
TinyPortal
© 2005-2018