How to draw an axis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Newbie
Newbie
Posts: 27
Joined: Wed Nov 09, 2022 12:00 am

How to draw an axis

Post by » Wed Aug 16, 2023 8:03 am

How to draw the red axis on a graph?
Using c++builder。
Attachments
Snipaste_2023-08-16_16-00-10.png
Snipaste_2023-08-16_16-00-10.png (16.23 KiB) Viewed 20110 times

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: How to draw an axis

Post by Pep » Thu Aug 17, 2023 11:16 am

Hello,
you can do this by using the ColorLine Tool (two, one for vertical and another one for horizontal).
You can find an example of use of the ColorLine tool in the TeeNew examples features included with the installation.

Please, do not hesitate to contact us in the case we can be of a further help.

Newbie
Newbie
Posts: 27
Joined: Wed Nov 09, 2022 12:00 am

Re: How to draw an axis

Post by » Fri Aug 18, 2023 9:48 am

I can't find it. Can you give me a demo?

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: How to draw an axis

Post by Pep » Fri Aug 18, 2023 2:00 pm

Hello,

you can use the following code to add a colorline tool and then customize it.

Code: Select all

//Now add colorlinetool outside the min/max range of the data
TColorLineTool *line = new TColorLineTool(TrendChart);
TrendChart->Tools->Add(line);
line->AllowDrag = false;
line->NoLimitDrag = false;
line->Axis = axisVert;
line->Pen->Color = clBlue;
line->Pen->Width = 2;
line->Value = 32;
Please, let us know in the case any help still needed.

Newbie
Newbie
Posts: 27
Joined: Wed Nov 09, 2022 12:00 am

Re: How to draw an axis

Post by » Mon Aug 21, 2023 2:01 am

line->Axis = axisVert;
What is axisVert???

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: How to draw an axis

Post by Pep » Mon Aug 21, 2023 5:54 am

Hello,
axisVert was used in the case you want to make use of a new custom axis, like:

Code: Select all

//Add vertical axis
TChartAxis *axisVert = new TChartAxis(TrendChart);

axisVert->Maximum = dblMax + 1;
axisVert->Minimum = dblMin - 1;
axisVert->Grid->Visible = true;
axisVert->Automatic = false;
axisVert->AutomaticMinimum = false;
axisVert->AutomaticMaximum = false;
axisVert->PositionPercent = 0;
axisVert->Horizontal = false;
axisVert->OtherSide = false;
axisVert->Visible = true;
axisVert->LabelsFont->Color = clRed;
but you can always use instead:

Code: Select all

Chart->Axes->left

Post Reply