Annotations without text

I'm trying to display a series as a line chart with a marker at each data point. I'm having trouble, in that when I turn on annotations, I not only get the symbol, but the text value as well, which I'm hoping to remove.

I can, of course, do this by using two series on the same data, one line one scatter, but that means I get two series in the legend, which looks kinda silly.

Is there ant way to do this that anyone knows?

Thanks,
Mike.

5 Replies

SA Saradha Syncfusion Team August 5, 2009 04:59 AM UTC

Hi Mike,

Thanks for your interest in syncfusion products.

To remove the text value from annotation, you could simply set the series annotation description as null.

serAnnot.Description = "";

Since you say that you use a Symbol I suppose its AdornmentInfo used rather than the Annotation.
To remove text from AdornmentInfo you could use a LabeTemplate with no value for the TextBlock as shown below.
---------------------------------



---------------------------------

---------------------------------

Please refer to the below given link for both the samples.
http://files.syncfusion.com/support/Chart.WPF/7.3.0.20/F88637/main.htm

Please let us know if you have further queries.

Regards,
K. Saradha Devi


MB Mike Berriman August 5, 2009 07:27 AM UTC

My apologies - I've only been working with Syncfusion a few days. I did of course mean Adornments, not annotations.

This would appear to do exactly what I want - I just wonder if there is a way to do this in C#, rather than XAML? I'm sure there is - but I'm still working my way around the conversion if you have the code handy.

Thanks,
Mike.


SA Saradha Syncfusion Team August 5, 2009 09:58 AM UTC

Hi Mike,

You could do the same in code behind as shown below

FrameworkElementFactory element = new FrameworkElementFactory(typeof(TextBlock));
DataTemplate dataTemplate = new DataTemplate();
dataTemplate.VisualTree = element;
adorn.LabelTemplate = dataTemplate;

Please refer to the modified sample from the below given link
http://files.syncfusion.com/support/Chart.WPF/7.3.0.20/F88637/Adornment_Modified.zip

Please let us know if you have any queries.

Regards,
K. Saradha Devi


MB Mike Berriman August 6, 2009 02:45 AM UTC

Perfect - many thanks.


JF John Fairbanks June 13, 2011 02:25 PM UTC

Is this still the simplest way to get a line series to have markers? Adding markers to your line series is simply a matter of flipping a switch on every other chart toolkit I've used... I'm hoping this has gotten better in the current version?


Loader.
Up arrow icon