TMapSeries title position

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

TMapSeries title position

Post by bdw » Tue Jun 24, 2014 10:08 pm

Hello,

I've just updated a project to the 2014.11.140512 and have an issue with a multiline title that used to position itself nicely in the middle of the rectangle shape.

I have tried turning off the new MapMarks->AutoSize and MapMarks->Centroid but no difference to its location.

Example image of the wrongly displayed title is added below. Is there anyway to get this to draw as it once did ?

[attachment=0]Snap-3.png[/attachment]
Attachments
Snap-3.png
Snap-3.png (3.81 KiB) Viewed 18770 times

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

Re: TMapSeries title position

Post by Yeray » Wed Jun 25, 2014 9:06 am

Hello,

I've tried to reproduce this with the code below:

Code: Select all

uses Chart, TeeGDIPlus, TeeMapSeries, TeeConst;

var Chart1: TChart;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Self.Caption:=TeeMsg_Version;

  Chart1:=TChart.Create(Self);
  Chart1.Parent:=Self;
  Chart1.Align:=alClient;
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TMapSeries) as TMapSeries do
  begin
    FillSampleValues(2);
    Labels.Labels[0]:='multiline'+sLineBreak+'label text';
    Labels.Labels[1]:='another multiline'+sLineBreak+'label text';
    Marks.Visible:=true;
  end;
end;
But this is what I'm getting, that looks correct to me:
maptest.png
maptest.png (16.52 KiB) Viewed 18725 times
Could you please try to modify the code above so we can reproduce the problem here?
Alternatively, could you please arrange a simple example project with the same purpose?

Thanks in advance.
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

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: TMapSeries title position

Post by bdw » Wed Jun 25, 2014 11:23 pm

Basic example as follows :-

TMapSeries* map = new TMapSeries(Chart1);
map->Marks->Visible = true;
Chart1->AddSeries(map);
Chart1->Legend->Visible = false;
TTeePolygon* shape = map->Shapes->Add();
shape->Text = "line 1\rline 2\rline 3";
shape->Closed = true;
shape->Points->AddXY(10, 10);
shape->Points->AddXY(10, 12);
shape->Points->AddXY(12, 12);
shape->Points->AddXY(12, 10);

Results in the following image which you can see the top of the text border is at the half way mark. With the older versions of TChart the text would be centred at Line 2 with Line 1 above the centre and Line 3 below the centre of the box.
Attachments
Snaps2.png
Snaps2.png (7.66 KiB) Viewed 18700 times

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

Re: TMapSeries title position

Post by Yeray » Thu Jun 26, 2014 10:09 am

Hello,

I've been able to reproduce the problem in GDI.
I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=815
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

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: TMapSeries title position

Post by bdw » Wed May 06, 2015 12:07 am

Hello,

This issue has cropped up again for us.

I see the bug was lodged 2014-06-26 but still has NOT fixed ? Status just says CONFIRMED.

Is there a work around for this ? If you can let me know which source function maybe ?

Seems GDI & GDI+ have this issue under VCL.

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: TMapSeries title position

Post by bdw » Wed May 06, 2015 2:01 am

Ok I spent a bit of time test with TAnnotationTool as a work around.

Then I decided to look at the source and found TeeMapSeries.pas line 2408 :-
APosition.LeftTop.Y:=tmpY {-(APosition.Height div 2)};

So for some reason the vertical alignment has been commented out, any reason for this ?

I have tested for our use putting this calculation back and it works correctly.

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

Re: TMapSeries title position

Post by Yeray » Wed May 06, 2015 11:49 am

Hello,

If the change you suggest works fine for you, don't hesitate to use it.
However, I'm afraid it doesn't seem to fix the sample code I posted in the ticket.
I've incremented the ticket priority.
http://bugs.teechart.net/show_bug.cgi?id=815
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

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: TMapSeries title position

Post by bdw » Wed May 06, 2015 9:02 pm

Hey Yeray,

Thanks

Yes was the code I tested with initially on 2015.15.150420 and our production release with last 2014.X

Its not perfect but pretty close to centered, image attached from 2015.X

Larger text is with the vertical adjustment in the DrawMark() function, the smaller test was just my quick test with TAnnotationTool
Attachments
Cursor_and_Windows_7_x64_Dev.png
Cursor_and_Windows_7_x64_Dev.png (22.51 KiB) Viewed 18478 times

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: TMapSeries title position

Post by bdw » Thu Sep 08, 2016 4:52 am

Just looking at this again in 2016.18 source version.

This does not seem to be fixed and my previous work around does not seem to be working.

Any insight into this ?

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: TMapSeries title position

Post by bdw » Thu Sep 08, 2016 5:59 am

After a few hours of head scratching and frustration trying to figure out why my Delphi test app worked but not my Cpp.

I figured it must be compiling to the wrong BPL or something like that even though the environment vars were set correctly.

I uninstalled the binary packages I had installed prior to source install (to get the docs) and it is working again.

Might just take a break now while I'm ahead!

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

Re: TMapSeries title position

Post by Yeray » Thu Sep 08, 2016 11:06 am

Hello,
bdw wrote:I uninstalled the binary packages I had installed prior to source install (to get the docs) and it is working again.
I'm sorry for the headaches caused but I'm glad to hear you found how to get it to work!

I've checked the #815 ticket and I may have found a fix for it.
Since I believe you own the sources, I would like you to confirm it before committing it to the production code.
At the TMapSeries.DrawMark method in TeeMapSeries.pas you'll find the snipped:

Code: Select all

      if MapMarks.AutoSize then
      begin
        tmpDiagonal:=tmpW/APosition.Width;
        tmpSize:=4*Sqrt(tmpDiagonal);
Change it for this:

Code: Select all

      if MapMarks.AutoSize then
      begin
        tmpDiagonal:=tmpW/APosition.Width;
        tmpSize:=Old*Sqrt(tmpDiagonal)/2;
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

bdw
Advanced
Posts: 130
Joined: Mon Mar 07, 2005 5:00 am
Location: New Zealand
Contact:

Re: TMapSeries title position

Post by bdw » Thu Sep 08, 2016 9:43 pm

Hi Yeray,

Well part of the frustration was also 10.1 and compilation issues, just some weird behavior with compiler locking up. Even had one instance where the whole VM was trying to automatically resize, had to do a power off of the VM. So quite a combination.

I tried your code above but that only effects the font size and not the vertical alignment.

The only method to get the 3 lines to vertically center is to restore the line :-

APosition.LeftTop.Y:=tmpY-(APosition.Height div 2)

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

Re: TMapSeries title position

Post by Yeray » Fri Sep 09, 2016 8:35 am

Hello,
bdw wrote:The only method to get the 3 lines to vertically center is to restore the line :-

APosition.LeftTop.Y:=tmpY-(APosition.Height div 2)
I see that line of code vertically centers the mark in the shape. I'll also add this line of code.
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

Post Reply