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
Padding of charts
Moderator: Queue Moderators
-
- Posts: 141
- Joined: Wed Mar 27, 2019 1:05 pm
Re: Padding of charts
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:
After this you can set margins manually. The syntax is slightly different depending on whether you are using WPF or WinForms:
Hope this helps.
Best regards,
Lasse
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;
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);
Best regards,
Lasse