TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
X-ray
- Newbie

- Posts: 18
- Joined: Thu Dec 15, 2022 12:00 am
Post
by X-ray » Tue Aug 12, 2025 8:38 am
Hello TeeChart Team,
How can I add (prefix) some text to the numerical output (Annotation) shown of the TColorLineTool?
I tried to change the Text in the OnDragLine Event like:
Code: Select all
procedure TfrmXYPlot.XYLimitDragLine(Sender: TColorLineTool);
begin
Sender.Annotation.Text := 'XY Limit: ' + Sender.Value.ToString;
end;
But that text doesn't show up?

- ColorLineToolAnnotation.png (72.55 KiB) Viewed 3111 times
Best regards,
Thomas
-
Yeray
- Site Admin

- Posts: 9728
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Mon Aug 18, 2025 2:22 pm
Hello Thomas,
Try setting AnnotationValue
to False
.
-
X-ray
- Newbie

- Posts: 18
- Joined: Thu Dec 15, 2022 12:00 am
Post
by X-ray » Mon Aug 18, 2025 5:39 pm
Hello Yeray,
Thanks, that works fine now!
-
X-ray
- Newbie

- Posts: 18
- Joined: Thu Dec 15, 2022 12:00 am
Post
by X-ray » Tue Aug 19, 2025 8:56 am
Hello,
The 2 lines produce 4 quadrants. Is it possible to draw one of the quadrants with a different background color?.
Actually the left/bottom one.

- 4 Quadrants
- SNRvsWPercentQuadrant.png (194.32 KiB) Viewed 1607 times
-
Yeray
- Site Admin

- Posts: 9728
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Tue Aug 19, 2025 9:20 am
Hello,
Assuming you know you have those ColorLine tools, you can use them to calculate the rectangle and draw it at
OnBeforeDrawAxes
event. Ie:

- quadrant.png (16.71 KiB) Viewed 1602 times
Code: Select all
uses Chart, Series, TeeTools;
var
Chart1: TChart;
HorizLine,
VertLine: TColorLineTool;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1:=TChart.Create(Self);
with Chart1 do
begin
Parent:=Self;
Align:=alClient;
Color:=clWhite;
Gradient.Visible:=False;
Walls.Back.Color:=clWhite;
Walls.Back.Gradient.Visible:=False;
Legend.Hide;
View3D:=False;
AddSeries(TPointSeries).FillSampleValues;
HorizLine:=TColorLineTool(Tools.Add(TColorLineTool));
with HorizLine do
begin
Axis:=Axes.Left;
Value:=Series[0].YValues.MinValue + Series[0].YValues.Range / 2;
end;
VertLine:=TColorLineTool(Tools.Add(TColorLineTool));
with VertLine do
begin
Axis:=Axes.Bottom;
Value:=Series[0].XValues.MinValue + Series[0].XValues.Range / 2;
end;
OnBeforeDrawAxes:=BeforeDrawAxes;
Draw;
end;
end;
procedure TForm1.BeforeDrawAxes(Sender: TObject);
var rect: TRect;
begin
if not Assigned(VertLine) or not Assigned(HorizLine) then
Exit;
rect.Left:=Chart1.Axes.Left.PosAxis;
rect.Right:=Chart1.Axes.Bottom.CalcPosValue(VertLine.Value);
rect.Bottom:=Chart1.Axes.Bottom.PosAxis;
rect.Top:=Chart1.Axes.Left.CalcPosValue(HorizLine.Value);
Chart1.Canvas.Brush.Color:=clRed;
Chart1.Canvas.Brush.Transparency:=200;
Chart1.Canvas.Rectangle(rect);
end;
-
X-ray
- Newbie

- Posts: 18
- Joined: Thu Dec 15, 2022 12:00 am
Post
by X-ray » Wed Aug 20, 2025 5:54 am
Thanks, Yeray, this works like a Charm, perfect!
Just this doesn't compile under VCL:
Code: Select all
Chart1.Canvas.Brush.Transparency:=200;
I think thats maybe FMX only?
-
Yeray
- Site Admin

- Posts: 9728
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Wed Aug 20, 2025 7:09 am
Hello,
Oups that was a spoiler of a new functionality for the next release.
Currently, to draw transparent shapes you need manually call
BeginBlending
and
EndBlending
. Ie:
Code: Select all
uses Chart, Series, TeeTools, TeCanvas;
//...
procedure TForm1.BeforeDrawAxes(Sender: TObject);
var
rect: TRect;
blend: TTeeBlend;
begin
//...
Chart1.Canvas.Brush.Color:=clRed;
blend:=Chart1.Canvas.BeginBlending(rect, 80);
Chart1.Canvas.Rectangle(rect);
Chart1.Canvas.EndBlending(blend);
end;