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

Chart Padding and Grid Lines

Thread ID:





115902 Feb 24,2014 06:34 AM UTC Feb 26,2014 01:04 PM UTC ASP.NET MVC (Classic) 1
Tags: Chart
Tony Basallo
Asked On February 24, 2014 06:34 AM UTC

I am trying to render a simple square chart for a dashboard. I only want to show the chart's area, with no grid lines, no padding and have the chart area take the complete size that I am making the chart.

For example:
chart.Size = new System.Drawing.Size(100, 100);

But the chart itself renders very small within the 100 pixels (see attached). Also, how do I get rid of all the grid lines?

Anandaraj T [Syncfusion]
Replied On February 26, 2014 01:04 PM UTC

 Hi Tony,

Thanks for using Syncfusion products.

We suggest you to disable "DrawGrid" property of axes and set "Transparent" color for "GridLineType.ForeColor" property of axes to remove the grid lines from chart.

Please refer the following code snippet to achieve this.
           //Hiding axis grid lines
            model.PrimaryXAxis.DrawGrid = false;
            model.PrimaryYAxis.DrawGrid = false;
            model.PrimaryXAxis.GridLineType.ForeColor = Color.Transparent;
            model.PrimaryYAxis.GridLineType.ForeColor = Color.Transparent;
            //Setting font for axes
            model.PrimaryXAxis.Font = new Font("Arial", 5);
            model.PrimaryYAxis.Font = new Font("Arial", 5);

We suggest you to set "0" for "ElementSpacing" property of chart model to remove padding from chart.

Please refer the following code snippet to achieve this.
           //Remove padding for chart
            model.ElementsSpacing = 0;

We have also created a simple sample for your requirement and the sample can be downloaded from the link below.

Please let us know if you have any concern.


Attachment: ChartMvc_5da238af.zip


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