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.

is it possible to have a Bar Chart with Text inside Bars

Thread ID:

Created:

Updated:

Platform:

Replies:

127289 Nov 8,2016 05:37 AM Nov 10,2016 12:28 AM Xamarin.iOS 3
loading
Tags: SfChart
Marco Vicente
Asked On November 8, 2016 05:37 AM

I want to make a chart with my Top 5 Customers
DataPoints1=newNSMutableArray();
DataPoints1.Add(newSFChartDataPoint(NSObject.FromObject("ClientOne"),NSObject.FromObject(9)));
DataPoints1.Add(newSFChartDataPoint(NSObject.FromObject("ClientTwo"),NSObject.FromObject(10)));
DataPoints1.Add(newSFChartDataPoint(NSObject.FromObject("ClientThree"),NSObject.FromObject(11)));
DataPoints1.Add(newSFChartDataPoint(NSObject.FromObject("ClientFour"),NSObject.FromObject(12)));
DataPoints1.Add(newSFChartDataPoint(NSObject.FromObject("ClientFive"),NSObject.FromObject(13)));
Is it possible to show the customer name inside the Bar?
I want to do this:

Thanks in advance

Sivaram Ganesan [Syncfusion]
Replied On November 9, 2016 08:26 AM

Hi Macro,

Thanks for contacting Syncfusion support.

We could able to achieve your requirement of displaying label inside the bar by setting DataMarkerPosition property as Center in SFBarSeries class and customize the data marker labels by using  GetFormattedDataMarkerLabel method in SFChartDelegate class.

Code Snippet :

 

public override NSString GetFormattedDataMarkerLabel(SFChart chart, NSString label, nint index, SFSeries series)
{ SFChartDataPoint datapoint = chart.DataSource.GetDataPoint(chart, index, chart.IndexOfSeries(series));
series.DataMarker.LabelStyle.Font = 
UIFont.SystemFontOfSize(25);
return
 datapoint.XValue as NSString;
}
 

  

SFBarSeries series = new SFBarSeries();
series.DataMarker.ShowLabel = true;
series.DataMarkerPosition = SFChartDataMarkerPosition.Center;
 



We have prepared sample based on your requirement and it can be downloaded from the following location.

Sample

Regards,
Sivaram.G.


Marco Vicente
Replied On November 9, 2016 09:10 AM

Thanks! Works perfectly

Sivaram Ganesan [Syncfusion]
Replied On November 10, 2016 12:28 AM

Hi Macro,

Most welcome.

Please let us know if you need further assistance on this.

Regards,
Sivaram.G.

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.

;