ViewXY: Legend Box Layout

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
Felix
Posts: 72
Joined: Tue Oct 29, 2013 8:10 am

ViewXY: Legend Box Layout

Post by Felix » Tue Aug 05, 2014 9:08 am

Hello Pasi,

how can I make the chart automatically adjust to the height of the Legend box?
LineChart_LegendBoxScaling.PNG
LineChart_LegendBoxScaling.PNG (37.6 KiB) Viewed 5860 times

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: ViewXY: Legend Box Layout

Post by ArctionPasi » Wed Aug 06, 2014 7:01 am

You can utilize LegendBox.GetRenderedRect() which tells the screen coordinates of the LegendBox. Adjust margins based on that.

In chart initialization, set chart.AxisLayout.AutoAdjustMargins = false.

In LegendBox.MovedByMouse and chart.SizeChanged event handler, use the following approach to adjust the margins. Here, top margin is adjusted based on legend box, others are at their fixed values.

Rectangle r = m_chart.ViewXY.LegendBox.GetRenderedRect();
m_chart.ViewXY.Margins = new Padding(100, r.Top + r.Height, 50, 30);
LightningChart Support Team, PT

Post Reply