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:

Created:

Updated:

Platform:

Replies:

115902 Feb 24,2014 06:34 AM UTC Feb 26,2014 01:04 PM UTC ASP.NET MVC (Classic) 1
loading
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.
<code>
[CS]
           //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);
</code>

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.
<code>
[CS]
           //Remove padding for chart
            model.ElementsSpacing = 0;
</code>

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.

Regards,
Anand

Attachment: ChartMvc_5da238af.zip

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.

Please sign in to access our forum

or the page will be automatically redirected to 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

;