DrawRectangle issue

Found a possible bug in LightningChart? Report it here.

Moderator: Arction_LasseP

Post Reply
RogerSaele
Posts: 8
Joined: Tue Jun 05, 2018 9:28 am

DrawRectangle issue

Post by RogerSaele » Mon Jun 18, 2018 12:59 pm

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?

ArctionKestutis
Posts: 367
Joined: Mon Mar 14, 2016 9:22 am

Re: DrawRectangle issue

Post by ArctionKestutis » Mon Jun 18, 2018 2:19 pm

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.

RogerSaele
Posts: 8
Joined: Tue Jun 05, 2018 9:28 am

Re: DrawRectangle issue

Post by RogerSaele » Mon Jun 18, 2018 3:17 pm

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

RogerSaele
Posts: 8
Joined: Tue Jun 05, 2018 9:28 am

Re: DrawRectangle issue

Post by RogerSaele » Tue Jun 19, 2018 9:16 am

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

RogerSaele
Posts: 8
Joined: Tue Jun 05, 2018 9:28 am

Re: DrawRectangle issue

Post by RogerSaele » Tue Jun 19, 2018 9:35 am

It gets even worse for right aligned y axes:
Image

ArctionKestutis
Posts: 367
Joined: Mon Mar 14, 2016 9:22 am

Re: DrawRectangle issue

Post by ArctionKestutis » Tue Jun 19, 2018 1:40 pm

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.

RogerSaele
Posts: 8
Joined: Tue Jun 05, 2018 9:28 am

Re: DrawRectangle issue

Post by RogerSaele » Thu Jun 21, 2018 10:59 am

I wanted to expand the rectangle returned by GetActiveAxisArea() to also contain the axis title.

ArctionKestutis
Posts: 367
Joined: Mon Mar 14, 2016 9:22 am

Re: DrawRectangle issue

Post by ArctionKestutis » Thu Jun 21, 2018 1:15 pm

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.

Post Reply