Page 1 of 1

DrawRectangle issue

Posted: Mon Jun 18, 2018 12:59 pm
by RogerSaele
Hi,

It seems that DrawRectangle gives wrong results. It is easiest seen by changing the angle of the chart title, which does not change the DrawRectangle at all. Another example is changing the y axis title angle from 90 to -90 where the title moves slightly, but also here the DrawRectangle remains unchanged:
Image

Might this be a bug, or is it expected behavior?

Re: DrawRectangle issue

Posted: Mon Jun 18, 2018 2:19 pm
by ArctionKestutis
Hi,

Are you talking about Title's DrawRectangle?
I don't believe there is any error, but you could try to proof that I am wrong. For better comparison, I would recommend drawing border around title, e.g. Title.Border.Style = Inner. Now you can do angle change - you should notice that box remains in the same place and only text alignment inside the box changes, which create illusion of movement. Similar with Axis range change: some labels takes more space and relative distance between Title and Axis is increased. But it is only axis drawing which move more to the right, while Title remains in the same place.

Re: DrawRectangle issue

Posted: Mon Jun 18, 2018 3:17 pm
by RogerSaele
Chart/ViewXY.XAxes/ViewXY.YAxes Title's DrawRectangle.

Here is a quick example using the demo app:

Chart title with angle of 0:
Image

Chart title with angle of 90:
Image

As you can see the only thing that changes is the DrawRectangle.Y, which seems to be measured from text center. Also take a look at default chart y axis title, which has an angle of 90, DrawRectangle.X = -23 seems wrong (X seems to be what it would have been had the title been rotated back to 0, without adjust acording to DistanceToAxis and with AutoAdjustMargins turned off):
Image

Re: DrawRectangle issue

Posted: Tue Jun 19, 2018 9:16 am
by RogerSaele
I also see that when drawing a border around the y axis title and rotate it to -90° the text changes location, but the border stays in place and does not properly surround the text anymore:
Image

Re: DrawRectangle issue

Posted: Tue Jun 19, 2018 9:35 am
by RogerSaele
It gets even worse for right aligned y axes:
Image

Re: DrawRectangle issue

Posted: Tue Jun 19, 2018 1:40 pm
by ArctionKestutis
Hi Roger,

Thank you for all the details. There are few separate issues here.
First about DrawRectangle. We did not clarify it before, but it is read only property of intermediate estimate. Note, that it gives accurate results only for Angle=0. Otherwise, reliable only Width, Height and central point. How are you intending to use this rectangle? LightningChart has Title.IsMouseOver() method or MouseOverOn/Off event, which will work just fine.

Second issue with Title's angle being -90 deg. This looks like text placement inside rectangle bug.

All the best.

Re: DrawRectangle issue

Posted: Thu Jun 21, 2018 10:59 am
by RogerSaele
I wanted to expand the rectangle returned by GetActiveAxisArea() to also contain the axis title.

Re: DrawRectangle issue

Posted: Thu Jun 21, 2018 1:15 pm
by ArctionKestutis
If you have AutoMargins (_chart.ViewXY.AxisLayout.AutoAdjustMargins = true), then it will be all area from Axis till chart edge. Otherwise, you would need to calculate Title's central point and based on angle estimate the extend of the box.