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. Image for the cookie policy date
close icon

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

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

3 Replies

SG Sivaram Ganesan Syncfusion Team November 9, 2016 01:26 PM UTC

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.



MV Marco Vicente November 9, 2016 02:10 PM UTC

Thanks! Works perfectly


SG Sivaram Ganesan Syncfusion Team November 10, 2016 05:28 AM UTC

Hi Macro,

Most welcome.

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

Regards,
Sivaram.G.

Loader.
Live Chat Icon For mobile
Up arrow icon