WPF Charting Documentation - SciChart WPF Charts SDK v5.x
Trading Annotation Creation Modifier

SciChart features a ChartModifier to help you create DrawingTools annotations on mouse click/drag. This is the TradingAnnotationCreationModifier.

NOTE: The Drawing Tools API in SciChart.Charting.DrawingTools is only available in the Enterprise and SDK Editions of SciChart

Adding an AnnotationCreationModifier in XAML

 

To add an TradingAnnotationCreationModifier to your chart, simply declare it in XAML or code-behind as follows:

<s:SciChartSurface>
   <!-- XAxis, YAxis, RenderableSeries omitted for brevity -->
   <s:SciChartSurface.ChartModifier>
      <s:ModifierGroup>
         <s:TradingAnnotationCreationModifier x:Name="annotationCreation"  
                    AnnotationCreated="OnAnnotationCreated"
                    AnnotationType="{x:Type s:ElliotWaveAnnotation}"/>
      </s:ModifierGroup>
   </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
// Create a SciChartSurface. XAxis, YAxis omitted for brevity
var sciChartSurface = new SciChartSurface();
var annotationCreationModifier = new TradingAnnotationCreationModifier()
{
       AnnotationType = typeof(ElliotWaveAnnotation),
};
sciChartSurface.ChartModifier = new ModifierGroup(
       annotationCreationModifier);

The TradingAnnotationCreationModifier will listen to mouse-clicks and create an annotation for you. It creates the annotation specified by the TradingAnnotationCreationModifier.AnnotationType. If you want to change the annotation type dynamically then set these properties in code or via a binding.

The event AnnotationCreated is fired when the annotation is created. You can use this event to perform some initialization or custom functionality when the annotation has been created by a user.

 

Handling Annotation Created via MVVM

If you are using the Annotations MVVM API then you will want to use AnnotationViewModels and handle the AnnotationCreated event in your viewmodel.

To help you with this, we have created a special type of modifier for creating drawing tools in MVVM called the TradingAnnotationCreationModifierMvvm.

Add it to your chart like this:

 

<!-- XAxis, YAxis, RenderableSeries omitted for brevity -->
<s:SciChartSurface.ChartModifier>
   <s:ModifierGroup>
       <tradingModifiers:TradingAnnotationCreationModifierMvvm
               AnnotationViewModelType="{Binding AnnotationType}"
               AnnotationViewModelsCollection="{Binding Annotations}"
               IsEnabled="{Binding IsAnnotationCreationEnable, Mode=TwoWay}"
               ReceiveHandledEvents="True">
        </tradingModifiers:TradingAnnotationCreationModifierMvvm>
   </s:ModifierGroup>
</s:SciChartSurface.ChartModifier>

 

 

 


SCICHART ® is a Registered Trademark in the UK, US and EU. Copyright SciChart Ltd 2011-2018.

Email us to give feedback!