Pre loader

"Annotations are Easy!"? - Why can't I get a simple Text Annotation on a DateTimeAxis chart then?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


As usual the basics of SciChart seem to be eluding me and I can’t get the simplest of features to work (hence the reference to it in the title).

All I want is an annotation in the top left of the screen in which I can dynamically change the text from the code behind – but no matter what I do it just wouldn’t do it. I therefore started a test project to see if I could work out what was going on and have recreated the problem only using XAML.

It would seem the annotation will only appear if the XAxis is defined as a “CategoryDateTimeAxis” AND it’s defined within “SciChartSurface.XAxes” tags. Any other combination and it won’t work.

Anyway – if someone could cast their eye over my test code and explain what’s happening I’d be most grateful.

    xmlns:s="" x:Class="AnnotationTest.MainWindow"
    Title="MainWindow" Height="350" Width="525">

    <s:SciChartSurface HorizontalAlignment="Stretch" VerticalAlignment="Stretch" s:ThemeManager.Theme="Chrome">

        <!-- Works - Slimmed down from the "Annotations are easy" example 
             <s:CategoryDateTimeAxis AxisAlignment="Bottom" AxisTitle="XAxis 1" Id="XAxis1" TextFormatting="0.0#" AutoRange="Always"/>
        <!-- Doesn't Work and this is from the "Interactions with Annotations" example 
            <s:CategoryDateTimeAxis AutoRange="Always"/>

        <!-- Doesn't Work - Slimmed down from the "Create Annotations Dynamically" example

        <!-- Doesn't Work - How our Axis are currently defined and what I would like to put a text annotation on
            <s:DateTimeAxis AxisTitle="Date" Id="XAxis1" AxisAlignment="Bottom"></s:DateTimeAxis>

            <s:NumericAxis TextFormatting="0.0#" VisibleRange="0, 10"/>

            <s:TextAnnotation HorizontalAnchorPoint="Center" Text="Anchor Center (X1, Y1)" VerticalAnchorPoint="Bottom" X1="5.0" XAxisId="XAxis1" Y1="8.0"/>



  • You must to post comments
Best Answer

Hi Stuart,

if you have a DateTimeAxis then X1 Y1 of the TextAnnotation must be of type Datetime.

CategoryDateTimeAxis expects integer values which correspond to data indices and NumericAxis expects numeric values.

If you want to place an annotation always in the top left then you need to check out AnnotationBase.CoordinateMode Relative. This allows you to specify coordinates as fractions from 0.0 to 1.0 regardless of axis type.

Hope this helps,

Best regards,

  • Stuart McCullough
    Oh! I told it was a fundamental thing! I was aware of the ability to specify in terms of fractions but I thought that was the default mode :-( Anyway - it's invaluable information you've supplied (as usual) which i'll use in sorting out my moving goalpost - they want the annotation to move with an associated (and dynamically created) VerticalLineAnnotation now. I've read somewhere that this should just be a binding between the two :-)
  • Andrew Burnett-Thompson
    they want the annotation to move with an associated (and dynamically created) VerticalLineAnnotation now. I've read somewhere that this should just be a binding between the two Yeah that should work, why not? No the default mode is CoordinateMode.Absolute. You can see all of them here: So, if you want to bind a text-annotation with a vertical line (BTW, Vertical lines do support labels, I believe, will have to check) then you should use the default CoordinateMode.Absolute and bind the X1 values together.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.