TeeChart for ActiveX, COM and ASP
-
amol
- Advanced
- Posts: 231
- Joined: Tue Mar 29, 2005 5:00 am
Post
by amol » Tue May 19, 2020 12:30 pm
Hi,
We are currently using Active X 2018. We have added a rectangle tool and are able to add its text, font and children etc. But we are unable to add text to its children.
Following is the code we are currently using
Code: Select all
ui->mChart->Tools()->Add(tcRectangle);
ui->mChart->Tools()->Items(0)->asRectangle()->SetText("Technology - Software - Infrastructure");
ui->mChart->Tools()->Items(0)->asRectangle()->Shape()->Font()->SetSize(12);
ui->mChart->Tools()->Items(0)->asRectangle()->Shape()->SetTransparency(30);
ui->mChart->Tools()->Items(0)->asRectangle()->SetAllowDrag(false);
ui->mChart->Tools()->Items(0)->asRectangle()->SetAllowResize(false);
ui->mChart->Tools()->Items(0)->asRectangle()->SetAutoSize(true);
ui->mChart->Tools()->Items(0)->asRectangle()->Shape()->Children()->Add();
ui->mChart->Tools()->Items(0)->asRectangle()->Shape()->Children()->Item(0)->Shape()->Font()->SetSize(16);
Please guide us as to how we could add text to the children elements too. Our target is to view different text with different font size and colors.
Regards,
Amol
-
Yeray
- Site Admin
![Site Admin Site Admin](./images/ranks/6stars.gif)
- Posts: 9534
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Fri May 22, 2020 9:09 am
Hello Amol,
You need to cast the Shape child to TCustomTextShape to access the Text property. Ie, this in Delphi:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
with TRectangleTool(Chart1.Tools.Add(TRectangleTool)) do
begin
Text:='Rectangle Tool';
Shape.Transparency:=10;
Shape.Font.Color:=clRed;
Shape.Font.Style:=Shape.Font.Style+[fsBold];
AutoSize:=True;
Left:=100;
Top:=100;
with Shape.Children.Add do
begin
Shape.Font.Color:=clGreen;
TCustomTextShape(Shape).Text:='Children';
end;
end;
end;
![Project1_2020-05-22_11-07-09.png](./download/file.php?id=7787&sid=3592e07e58cf6fa8e6ae896f4cea21b1)
- Project1_2020-05-22_11-07-09.png (4.83 KiB) Viewed 26193 times
Sorry, I thought it was VCL. Let me check if this property is mapped in ActiveX.