We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Margin control of chart using c#

Thread ID:

Created:

Updated:

Platform:

Replies:

124317 May 31,2016 11:06 AM Jun 1,2016 05:04 AM UWP 2
loading
Tags: SfChart
Jason Traud
Asked On May 31, 2016 11:06 AM

I'm attempting to do as much of the code as I can in C# over XAML. How do you properly control the margins of a chart? I've been trying the code below but I'm getting errors. Any advice?


        SfChart chart = new SfChart();
            chart.Margin.Top = 60;
            chart.Margin.Left = 20;
            chart.Margin.Right = 20;
            chart.Margin.Bottom = 0;

Jason Traud
Replied On May 31, 2016 05:39 PM

I figured this out myself. I needed to do this:

Thickness chartMargin = new Thickness(20);
chart.Margin = chartMargin;



Devi Aruna Maharasi Murugan [Syncfusion]
Replied On June 1, 2016 05:04 AM

Hi Jason,  
  
Thanks for contacting Syncfusion Support. 
  
To achieve your requirement of setting margin for SfChart in C# use the following code sample. 
  
Code Sample:   
[C#]   
   
SfChart chart = new SfChart();   
   
//Thickness has been initialized for setting margin   
Thickness margin = new Thickness(20,10,20,10);   
   
//Newly initialized thickness object is assigned to the Chart Margin   
chart.Margin = margin;   
   
  
Please find the demo sample from the below link.  
  
Sample:Chart_Margin 
  
Regards, 
Devi M   


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;