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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Margin control of chart using c#

Thread ID:





124317 May 31,2016 03:06 PM UTC Jun 1,2016 09:04 AM UTC UWP 2
Tags: SfChart
Jason Traud
Asked On May 31, 2016 03:06 PM UTC

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 09:39 PM UTC

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 09:04 AM UTC

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:   
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.  
Devi M   


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon