Page 1 of 1

Legend.TopPos

Posted: Tue Dec 09, 2008 4:52 pm
by 9337917
Folks,

Question concerning Legend.TopPos.

With Chart1.Legend.Alignment set to either Top or Bottom (laTop or laBottom), a value of 0 for TopPos automatically centers the legend rect horizontally within the chart. Lovely. The left side of the legend is not set at the 0'th coordinate, the Legend is centered within the "row".

Now (you know what's coming next, don't you?!) ... if Legend.Alignment is Left or Right, a value of 0 does not center it vertically, it positions the Legend's top effectively at the top of the chart. That seems inconstent, let alone fun to explain to users: "A value of 0 for "Legend position adjust" automatically centers the Legend if you're aligning it Top or Bottom. But if you're positioning the Legend Left or Right? A value of 0 for the Legend position adjust places it at the top of the chart."

Help indicates:
The TopPos property specifies the Legend's top (or left) position as a percentage of the total chart height (or width).

When the Alignment property is laLeft or laRight (vertical Legend), the TopPos property increments the Top Legend position by a percentage of the total chart height.

For laTop or laBottom Legend alignments (horizontal Legend), the TopPos property increments the Legend's Left position.
Can you help explain what's seen as an inconconsistency by my users of a 0 value (beautifully) centering the Legend horizontally for Top- or Bottom- aligned Legends, but for Left- or Right-aligned Legends a zero value places the Legend at the chart's top, rather than centered vertically? I'm not finding the right words to properly explain it to them!

Thank you so much...:)
richard diamond

Posted: Tue Dec 09, 2008 5:20 pm
by narcis
Hi richard,

This inconsistency seems a bug to me. I've added the issue to the defect list (TV52013640) to be investigated for next releases.

Regarding what to say to your clients/users, I'm afraid I can't help you much on that. I'm not a native English speaker so I guess you can easily find a more appropiate way to describe this behavior than I can. The only way I can think of is saying that this property behaves in a different way when the legend is in vertical or horizontal position.

Posted: Wed Dec 10, 2008 10:59 pm
by 9337917
Narcís,

You had me, literally, laughing. While you may not be a native English speaker, I can assure you of two things:

1) Your English is far better than my Spanish
2) Your English is far better than most AMERICANS (not that they've raised the bar very high, from what I've seen online)

Yes, my instincts were to consider it a bug, but before I went that route, I thought perhaps the problem was my understanding of the proper use, and interpretation, of TopPos, so I wanted to check with you first.

As I re-read my starting post later the day I posted it, I confused MYSELF about what I was saying. I'm glad you could find your way through the fog...;)

With Top- and Bottom-aligment, setting TopPos to 0 centers it, negative values move it left, positive values move it right. Totally intuitive.

Left- and right-aligned legends should behave in the same manner. If TopPos is 0, it's centered vertically (taking into account Legend.VertSpacing), a negative value moves it towards the top, a positive value pushes it down towards the bottom.

Right now, here's a part of what I've done in Chart1GetLegendRect to solve the problem of automatically centering, vertically, Left- or Right-aligned Legends :

Code: Select all

var
  iHalfHeight : integer;
  iVertCenter : integer;
begin
  if(  not Chart1.Legend.CustomPosition ) then begin
    if( Chart1.Legend.Vertical ) then begin   // i.e.,  Chart1.Legend.Alignment in [ laLeft, laRight ]
        iHalfHeight := ( Chart1.Legend.Height div 2 );
        iVertCenter := ( Chart1.Height div 2 );
        Rect.Top    := iVertCenter - iHalfHeight;
        Rect.Bottom := iVertCenter + iHalfHeight;
     end
  end;
end;
Kludgey, yeah, but for now it's a work-around. It would great to have something for V7(.12+), but I understand the dynamics of release management.

By the way, I learned a little lesson along the way with this Post. I wondered why I hadn't back from you, you're always incredibly responsive! I started to pout, then thought to myself... "Umm.. maybe, diamond, you forgot to click Notify me when a reply is posted"???? Sure enough, I was the problem.

Thanks for your attention to this, Narcís!!!
Regards,
richard diamond[/b]

Posted: Thu Dec 11, 2008 9:50 am
by narcis
Hi Richard,

You're very welcome!
1) Your English is far better than my Spanish
Even my Spanish may be slighly better than my English, I use English more often. My mother tongue is Catalan. I only use Spanish for some reading and TV.
2) Your English is far better than most AMERICANS (not that they've raised the bar very high, from what I've seen online)
Really :lol:? I don't think so, thanks anyway! I can read and write English better than I can speak as that's what I practice less.
As I re-read my starting post later the day I posted it, I confused MYSELF about what I was saying. I'm glad you could find your way through the fog...
I could easily understand it. I didn't found it that foggy ;-).
Kludgey, yeah, but for now it's a work-around. It would great to have something for V7(.12+), but I understand the dynamics of release management.
I'm glad to hear that you found a workaround. I think it's unlikley this will be fixed in v7. However, if you see TV52013640 fixed in v8's release notes we may be able to let you know about the changes in the sources necessary for fixing this.

Posted: Fri Dec 12, 2008 4:40 am
by 9337917
Narcís,

I would be most appreciative of any kind of fix-up code you could send my way that I might shoe-horn into V7 when you turn your attention to this particular issue...:) It would be the absolute icing on the cake as far as feature-set I'm offering my users.

Regards from California to Catalonia,
richard diamond

Posted: Fri Dec 12, 2008 8:52 am
by narcis
Hi Richard,

I've added a comment at bug's description to let you know about source code changes. However, it's difficult for us tracking that sort of things so I recommend you to also be aware at new release announcements on this forum or our RSS news feed. If you see this bug in the release notes please ask us for the code changes.

BTW: AFAIK California and Catalonia have very similar climates ;).