Page 1 of 1
TMapSeries title position
Posted: Tue Jun 24, 2014 10:08 pm
by 9236183
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]
Re: TMapSeries title position
Posted: Wed Jun 25, 2014 9:06 am
by yeray
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 (16.52 KiB) Viewed 22337 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.
Re: TMapSeries title position
Posted: Wed Jun 25, 2014 11:23 pm
by 9236183
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.
Re: TMapSeries title position
Posted: Thu Jun 26, 2014 10:09 am
by yeray
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
Re: TMapSeries title position
Posted: Wed May 06, 2015 12:07 am
by 9236183
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.
Re: TMapSeries title position
Posted: Wed May 06, 2015 2:01 am
by 9236183
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.
Re: TMapSeries title position
Posted: Wed May 06, 2015 11:49 am
by yeray
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
Re: TMapSeries title position
Posted: Wed May 06, 2015 9:02 pm
by 9236183
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
Re: TMapSeries title position
Posted: Thu Sep 08, 2016 4:52 am
by 9236183
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 ?
Re: TMapSeries title position
Posted: Thu Sep 08, 2016 5:59 am
by 9236183
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!
Re: TMapSeries title position
Posted: Thu Sep 08, 2016 11:06 am
by yeray
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;
Re: TMapSeries title position
Posted: Thu Sep 08, 2016 9:43 pm
by 9236183
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)
Re: TMapSeries title position
Posted: Fri Sep 09, 2016 8:35 am
by yeray
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.