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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

set label width in chart

Thread ID:

Created:

Updated:

Platform:

Replies:

143776 Apr 4,2019 02:18 PM UTC Apr 12,2019 11:18 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: Presentation
Manolo Capdevila
Asked On April 4, 2019 02:18 PM UTC

Hi,

How can I set the width of data label.

For example, in these charts, I want the 260;44% in a single line, but I don't know how set the width.

I try this:

            IOfficeChartSerie serie = chart.Series.Add("Serie");
            serie.Values = chart.ChartData[2, 2, tmpDatosChart.Count + 2, 2];
            serie.CategoryLabels = chart.ChartData[2, 1, tmpDatosChart.Count + 2, 1];
            serie.DataPoints.DefaultDataPoint.DataLabels.Layout.ManualLayout.WidthMode = LayoutModes.factor;
            serie.DataPoints.DefaultDataPoint.DataLabels.Layout.ManualLayout.Width = 400;

But I doesn't work


Thanks

Meikanda Nayanar [Syncfusion]
Replied On April 8, 2019 12:18 PM UTC


Hi Manolo, 

Thank you for contacting Syncfusion support. 

Using the below code snippet will modify the height and width of the Data Label of the particular series of chart.  
  
//Get the first occurrence of chart  
IPresentationChart chart = presentation.Slides[0].Charts[0];  
  
//Change the Height of the dataLabel of the first series of the chart.  
chart.Series[0].DataPoints[1].DataLabels.Layout.ManualLayout.Height = 0.25;  
  
//Change the Width of the dataLabel of the first series of the chart.  
chart.Series[0].DataPoints[1].DataLabels.Layout.ManualLayout.Width = 0.5;  
  
//Change the Height of the dataLabel of the Second series of the chart.  
chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Width = 0.5;  
  
//Change the Height of the dataLabel of the Second series of the chart.  
chart.Series[0].DataPoints[0].DataLabels.Layout.ManualLayout.Height = 0.20;  
  
Note: Value ranges from 0 to 1.  
  
For more reference, please use this sample which will be helpful for you.  

Thanks 
Meikandan 



Manolo Capdevila
Replied On April 12, 2019 10:05 AM UTC

Thanks

Meikanda Nayanar [Syncfusion]
Replied On April 12, 2019 11:18 AM UTC

Hi Manolo,

Welcome. We are always happy to help.

We hope our code snippets worked at your end to modify the height and width of the Data Label of the series of a chart, and our products suit your business requirements.

Please let us know if you need any further assistance in this.

Thanks

Meikandan


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

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

Live Chat Icon For mobile
Live Chat Icon