Page 1 of 1

Bar series - text alignment issue in marks label

Posted: Wed Sep 05, 2012 11:21 am
by 10049140
Hi.

I encountered a strange issue on one Windows XP machine
Image

It seems like the percent value shown in the marks is not correctly aligned.

I am using TeeChart Pro 2012.06.120613 with Delphi XE2.

Is this a known issue?

Note: This issue did not occur with TeeChart Pro V8 and Delphi 2010, which I used before updating to Delphi XE2.

Best regards.

Re: Bar series - text alignment issue in marks label

Posted: Thu Sep 06, 2012 7:54 am
by yeray
Hi,

I'm getting the following with the code below and TeeChart Pro v2012.06, XE2 in a Win7 x64 machine:
Marks_align.png
Marks_align.png (31.29 KiB) Viewed 13988 times

Code: Select all

uses Series, TeeGDIPlus;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    tmp: Double;
begin
  Chart1.Canvas:=TGDIPlusCanvas.Create;

  with Chart1.AddSeries(TBarSeries) as TBarSeries do
  begin
    for i:=0 to 5 do
    begin
      tmp:=random*75+25;
      Add(tmp, FormatFloat('#0.#', tmp) + ' MB');
    end;

    Marks.Style:=smsLabelPercent;
    Marks.MultiLine:=true;
  end;
end;
Could you please try the code above to see if you still reproduce the problem with it?
Otherwise, it would mean you are doing something different than me. If that's the case, please, modify the code so we can reproduce the problem here, or arrange a simple example project we can run as-is for the same.

Thanks in advance.

Re: Bar series - text alignment issue in marks label

Posted: Fri Sep 07, 2012 12:30 pm
by 10049140
Dear Yeray,

It was a little bit tricky, but i found the reson for this issue.
It seems like this issue only occurs when using "gpfDefault" as value for the property "AntiAliasText" of TGDIPlusCanvas.

The modified code should look like this:

Code: Select all

uses Series, TeeGDIPlus;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    tmp: Double;
    lCanvas: TGDIPlusCanvas;
begin
  lCanvas := TGDIPlusCanvas.Create;
  lCanvas.AntiAliasText := gpfDefault;
  Chart1.Canvas := lCanvas;

  with Chart1.AddSeries(TBarSeries) as TBarSeries do
  begin
    for i:=0 to 5 do
    begin
      tmp:=random*75+25;
      Add(tmp, FormatFloat('#0.#', tmp) + ' MB');
    end;

    Marks.Style:=smsLabelPercent;
    Marks.MultiLine:=true;
  end;
end;
Please note that this issue does not occur on all machines.
I can rerpduce this on a Windows XP machine with SP3.

Best regards.

Re: Bar series - text alignment issue in marks label

Posted: Fri Sep 07, 2012 3:07 pm
by yeray
Hi,

I could reproduce it both in a WinXP and a Win7 machine, but slightly different. In XP it seems to happen with both gpfDefault and gpfNormal, while in Win7 it seems to only happen with gpfNormal.
I've added it to the wish list to be investigated (TV52016337).
In the meanwhile, I'd suggest you to use gpfBest or gpfClearType.

Re: Bar series - text alignment issue in marks label

Posted: Mon Sep 10, 2012 11:16 am
by 10049140
Dear Yeary,

Thanks for your fast response and the suggested workaround!

gpfClearType is exactly what I was looking for and fits perfectly!
I wonder why I did not regard this option before?!

Best regards.

Re: Bar series - text alignment issue in marks label

Posted: Mon Sep 10, 2012 11:32 am
by yeray
Hi Marder,

Great! :D

Re: Bar series - text alignment issue in marks label

Posted: Wed May 29, 2013 12:31 pm
by 10049140
Dear Yeray.

I fear this issue has been reintroduced in TeeChart Pro V2013 =(

When I create a test project including only the code of your first post in this Thread I get the following result:
Image

I tested all types of AntiAliasText (gpfNormal, gpfDefault, gpfBest and gpfClearType)
It does not seem to make any difference. Seems like AntiAliasText is no longer regarded at all in V2013?!

Could you please assist?
Thanks and best regards

Re: Bar series - text alignment issue in marks label

Posted: Wed Jun 05, 2013 3:26 pm
by 10049140
Hi.

Do you have any suggestions for this issue with TeeChart Pro V2013?

Best regards.

Re: Bar series - text alignment issue in marks label

Posted: Thu Jun 06, 2013 2:25 pm
by yeray
Hi,

I've incremented the ticket priority and added a couple of examples to reproduce the problem in the same ticket (TV52016337). So I hope this will work better in future releases.

The only workaround I can think right now is to modify the TextAlign:

Code: Select all

Marks.TextAlign:=taLeftJustify;