WPF Charting Documentation - SciChart WPF Charts SDK v5.x
Pitchfork Drawing Tool

The PitchforkAnnotation allows a user to draw a Pitchfork or Channel on a price chart. To create this annotation you have to set points at critical turning-points that will be connected by lines and polygons. Those points were limited by BasePointsCount (default value is 6).

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

The PitchforkAnnotation

 

The PitchforkAnnotation is a CompositeAnnotation (an annotation which consists of a number of other annotations) which consists of:

Additional properties specific to HeadAndShouldersAnnotation include:

Adding a PitchforkAnnotation via mouse click

To add a PitchforkAnnotation via mouse click you have to add TradingAnnotationCreationModifier to your SciChartSurface.ChartModifier and set AnnotationType as PitchforkAnnotation. Please see the article on the TradingAnnotationCreationModifier for how to use this type.

Declaring a PitchforkAnnotation in XAML

To declare a PitchforkAnnotation in XAML you have to declare the annotation and then declare its InitialBasePoints collection that is actually collection of ComparablePoint objects. ComparablePoint stores X and Y values that are used for placing annotation point. InitialBasePoints collection is limited by BasePointsCount value. And default value is 3.

Declaring a PitchforkAnnotation in XAML
Copy Code
<!-- XAxis, YAxis, RenderableSeries omitted for brevity -->
<s:SciChartSurface.Annotations>
    <!--Declare PitchforkAnnotation-->
    <s:PitchforkAnnotation IsEditable="True">
    <!-- Declare InitialBasePoints collection that is used for
         creating annotation from XAML.
         InitialBasePoints is actually observable collection of
         ComparablePoint-s. ComparablePoint stores X and Y point Value.
    -->
         <s:PitchforkAnnotation.InitialBasePoints>
             <!-- Placing first point -->
             <s:ComparablePoint X="0"  Y="0"/>
             <!-- Placing second point -->
             <s:ComparablePoint X="2"  Y="4"/>
             <!-- Placing third point -->
             <s:ComparablePoint X="4"  Y="0"/>
                       
         </s:PitchforkAnnotation.InitialBasePoints>
    </s:PitchforkAnnotation>
</s:SciChartSurface.Annotations>

Please Note that the PitchforkAnnotation has limit of 3 base points. As you can see here, you just have to set these 3 points for the annotation: [X1=0; Y1=0], [X2=2; Y2=4], [X3=4; Y3=0]

 

 

Declaring a PitchforkAnnotation in Code-Behind

To add a PitchforkAnnotation in code, simply use the following C# code:

Example Title
Copy Code
// Create a SciChartSurface. XAxis, YAxis omitted for brevity
var sciChartSurface = new SciChartSurface();
// Create a PitchforkAnnotationAnnotation.
var pitchfork = new PitchforkAnnotation();
// PitchforkAnnotationAnnotation should be added to
//SciChartSurface.Annotation collection first, to make SetBasePoint() method
//works correctly
sciChart.Annotations.Add(pitchfork);
// Set first point of PitchforkAnnotationAnnotation
pitchfork.SetBasePoint(0, 0);
   
// Set second point of PitchforkAnnotationAnnotation
pitchfork.SetBasePoint(2, 4);
 // Set third point of PitchforkAnnotationAnnotation
pitchfork.SetBasePoint(4, 0);   

 

Declaring a PitchforkAnnotation in MVVM

To add a PitchforkAnnotation via MVVM please follow the instructions for adding annotations with MVVM: Declaring Annotations in MVVM with the AnnotationsBinding Markup Extension

To add a PitchforkAnnotation via a ViewModel you have to use SciChart markup extension called AnnotationsBinding,

The AnnotationsBinding Markup Extension
Copy Code
<s:SciChartSurface Annotations="{s:AnnotationsBinding Annotations}">
</s:SciChartSurface>

Now you need to create collection for Annotations in ViewModel. Then create and add an PitchforkAnnotationViewModel to that collection of Annotations like this:

ViewMode
Copy Code
public class MyViewModel : INotifyPropertyChanged
 { 
    public ObservableCollection<IAnnotationViewModel> Annotations { get; }
 
    public void Foo()
    {
        // Create a PitchforkAnnotationAnnotation.
        pitchfork = new PitchforkAnnotationViewModel();
        // PitchforkAnnotationAnnotation should be added to
        //SciChartSurface.Annotation collection first, to make SetBasePoint() method
        //works correctly
        Annotations.Add(pitchfork);
        // Set first point of PitchforkAnnotationAnnotation
        pitchfork.SetBasePoint(0, 0);
           
        // Set second point of PitchforkAnnotationAnnotation
        pitchfork.SetBasePoint(2, 4);
         // Set third point of PitchforkAnnotationAnnotation
        pitchfork.SetBasePoint(4, 0);   
    }
 }

 

 

 

 

 

 


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

Email us to give feedback!