Labels for horizontal series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
EdDressel
Newbie
Newbie
Posts: 35
Joined: Mon Nov 25, 2019 12:00 am

Labels for horizontal series

Post by EdDressel » Fri Mar 06, 2020 12:26 am

Attached is a simple demo where the horizontal series caption has two lines. Works fine.

My customer wants two modifications that I do not know how to do:

1) They would like the left axis labels to be right-aligned.

2) They would the second line (the value) bolded.

Are either of those possible?

Thank you,

Ed Dressel
Attachments
Horz Series Left Axis Caption.zip
(1.97 KiB) Downloaded 1064 times
Ed Dressel
President
RetireReady Solutions

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Labels for horizontal series

Post by Yeray » Fri Mar 06, 2020 11:21 am

Hello,

Is this what you are trying to achieve?
Project1_2020-03-06_11-57-48.png
Project1_2020-03-06_11-57-48.png (9.62 KiB) Viewed 14363 times
This is the code I used to draw the above:

Code: Select all

constructor TForm1.Create(aOwner: TComponent);
var
  lValue: currency;
  I: Integer;
  lCaption: string;
begin
  inherited;
  for I := 1 to 5 do begin
    lValue := Trunc(Random(1000));
    lCaption := Format('Item #%d'+sLineBreak+'<b>%.0m</b>', [I, lValue]);
    Series1.AddBar(lValue, lCaption, clTeeColor);
  end;

  Chart1.Axes.Left.LabelsFormat.TextAlignment:=taRightJustify;
  Chart1.Axes.Left.LabelsFormat.TextFormat:=ttfHtml;
end;
As you can see I'm using Html format to customize part of the labels. Note there was a bug I've just fixed: #2294.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

EdDressel
Newbie
Newbie
Posts: 35
Joined: Mon Nov 25, 2019 12:00 am

Re: Labels for horizontal series

Post by EdDressel » Thu Mar 12, 2020 8:38 pm

That's cool... but I don't know how you did that--attached is my demo that neither right aligns the values not bolds the items.

What am I doing wrong?

Ed Dressel
Attachments
Horz Series Left Axis Caption 2.zip
(6.73 KiB) Downloaded 1005 times
Ed Dressel
President
RetireReady Solutions

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Labels for horizontal series

Post by Yeray » Fri Mar 13, 2020 11:41 am

Hello,

You missed this part in your code:

Code: Select all

  Chart1.Axes.Left.LabelsFormat.TextAlignment:=taRightJustify;
  Chart1.Axes.Left.LabelsFormat.TextFormat:=ttfHtml;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

EdDressel
Newbie
Newbie
Posts: 35
Joined: Mon Nov 25, 2019 12:00 am

Re: Labels for horizontal series

Post by EdDressel » Fri Mar 13, 2020 5:12 pm

Perfect. Thank you.
Ed Dressel
President
RetireReady Solutions

Post Reply