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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TextLabel, relative positioning and applying a background.

Thread ID:

Created:

Updated:

Platform:

Replies:

121083 Nov 9,2015 05:11 PM UTC Nov 12,2015 12:02 PM UTC WPF 3
loading
Tags: SfChart
Jeremie Clos
Asked On November 9, 2015 05:11 PM UTC

Hello again,

I couldn't find anything in the documentation so I assume that it's either not documented or not a feature, but I figured I should ask. Is it possible to apply a TextLabel in a SfChart:
  1. With relative positioning? Meaning having the label always at the same place with respect to the chart, without having to toy with X and Y positioning myself.
  2. With a white background? Currently it's hard to read the label because of the lines of the chart. It would be neat to be able to specify a background color in order to keep it readable.
Thank you for your help.

Regards,
Jeremie

Rachel A [Syncfusion]
Replied On November 10, 2015 09:45 AM UTC

Hi Jeremie,

Thanks for contacting Syncfusion support.

We can achieve your requirement by using TextAnnotation in SfChart. TextAnnotation is used to add text inside chart area. We have prepared the sample for your reference and you can download the sample from the following location.

Chart_WPF_Sample

Please find the following UG documentation to know more about TextAnnotation.

http://help.syncfusion.com/wpf/sfchart/annotations#textannotation

Regards,
Rachel. A

Jeremie Clos
Replied On November 11, 2015 02:29 PM UTC

Thanks Rachel it looks good.

One other question on the same topic: I want to bind the location of this Label to an expression that depends partly on the width of a Column in a ColumnSeries. How do I retrieve the width of columns?

Sumathi Jayaraj [Syncfusion]
Replied On November 12, 2015 12:02 PM UTC

Hi Jeremie,

Thanks for the update.

We have analyzed your requirement and we are able to calculate the individual segment width as per the below code snippet. 

Code snippet[C#]:



//To calculate the column segment width        

private void chart_Loaded(object sender, RoutedEventArgs e)

{

    var segmentsCount = (series.ItemsSource asObservableCollection<Model>).Count;

    var segmentWidth = chart.SeriesClipRect.Width / segmentsCount;

    var columnSgmtWidth = segmentWidth * (1- ChartSeries.GetSpacing(series));
}


 
Regards,
Sumathi J

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.

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

;