Page 1 of 1

Padding of charts

Posted: Wed Jun 03, 2020 11:22 am
by Energetic
Hello,
How can I define Padding for my charts in WPF? When I set Padding in XAML in the chart control nothing appears to change. Currently the last digits of the axis values (of an axis with no title) go exactly to the end of the lightning chart control area, but I would like to have a few pixels of distance with the chart background before the end of the control

Re: Padding of charts

Posted: Thu Jun 04, 2020 9:13 am
by Arction_LasseP
Hello,

I would say that the best option here is to set margins manually. By default, the margins in LightningChart are automatically calculated based on various components such as axis titles and labels and chart title. Therefore, you need to first disable AutoAdjustMargins -property:

Code: Select all

_chart.ViewXY.AxisLayout.AutoAdjustMargins = false;
After this you can set margins manually. The syntax is slightly different depending on whether you are using WPF or WinForms:

Code: Select all

// In WPF:
_chart.ViewXY.Margins = new System.Windows.Thickness(50, 30, 50, 70); // Left, top, right, bottom

// In WinForms:
_chart.ViewXY.Margins = new Padding(50, 30, 50, 70);
Hope this helps.
Best regards,
Lasse