Search Results for

    Show / Hide Table of Contents

    The XabcdAnnotation

    The XabcdAnnotation is a specialized multi-point annotation used for drawing harmonic patterns (such as Gartley, Butterfly, Bat, and Crab patterns) which consist of 5 points: X, A, B, C, and D.

    Xabcd Annotation

    Note

    Examples of the Annotations usage can be found in the SciChart Android Examples Suite as well as on GitHub:

    • Native Android Chart Annotations Example

    • Native Android Chart Interactive Annotations Example

    • Xamarin Android Chart Annotations Example

    • Xamarin Android Chart Interactive Annotations Example

    Points and Ratios

    The XabcdAnnotation requires 5 points to be placed. Once all points are set, it automatically calculates and displays the following Fibonacci-style ratios:

    • XB Ratio: Calculated as |B - A| / |A - X|
    • AC Ratio: Calculated as |C - B| / |B - A|
    • BD Ratio: Calculated as |D - C| / |C - B|
    • XD Ratio: Calculated as |D - A| / |A - X|

    These ratios are calculated based on the values on the specified ratioAxisId. If no axis ID is specified, the primary Y-Axis is used.

    Appearance Properties

    The following properties can be used to customize the appearance of the XabcdAnnotation:

    • stroke: Sets the pen style for the primary lines (XA, AB, BC, CD) and the secondary dashed lines (XB, AC, BD, XD).
    • fill: Sets the brush style for the two filled triangular areas (XAB and BCD).

    Create an XabcdAnnotation

    An XabcdAnnotation can be added onto a chart using the following code:

    • Java
    • Java with Builders API
    • Kotlin
    // Assume a surface has been created and configured somewhere
    // Create an XabcdAnnotation
    final XabcdAnnotation xabcdAnnotation = new XabcdAnnotation(getContext());
    
    // Allow to interact with the annotation in run-time
    xabcdAnnotation.setIsEditable(true);
    
    // Specify the stroke and fill
    xabcdAnnotation.setStroke(new SolidPenStyle(Color.YELLOW, true, 2f, null));
    xabcdAnnotation.setFill(new SolidBrushStyle(Color.BLUE));
    
    // Add 5 points (X, A, B, C, D)
    xabcdAnnotation.setBasePoint(10, 30.6); // X
    xabcdAnnotation.setBasePoint(30, 31.5); // A
    xabcdAnnotation.setBasePoint(50, 30.3); // B
    xabcdAnnotation.setBasePoint(70, 31.5); // C
    xabcdAnnotation.setBasePoint(90, 30.6); // D
    
    // Add the annotation to the AnnotationsCollection of a surface
    surface.getAnnotations().add(xabcdAnnotation);
    
    // Assume a surface has been created and configured somewhere
    // Create an XabcdAnnotation using the SciChartBuilder
    final XabcdAnnotation xabcdAnnotation = sciChartBuilder.newXabcdAnnotation()
            .withStroke(new SolidPenStyle(Color.YELLOW, true, 2f, null))
            .withFill(new SolidBrushStyle(Color.BLUE))
            .withBasePoint(10, 30.6)
            .withBasePoint(30, 31.5)
            .withBasePoint(50, 30.3)
            .withBasePoint(70, 31.5)
            .withBasePoint(90, 30.6)
            .withIsEditable(true)
            .build();
    
    // Add the annotation to the AnnotationsCollection of a surface
    surface.getAnnotations().add(xabcdAnnotation);
    
    // Assume a surface has been created and configured somewhere
    // Create an XabcdAnnotation
    val xabcdAnnotation = XabcdAnnotation(context)
    
    // Specify the stroke and fill
    xabcdAnnotation.stroke = SolidPenStyle(Color.YELLOW, true, 2f, null)
    xabcdAnnotation.fill = SolidBrushStyle(Color.BLUE)
    
    // Add 5 points (X, A, B, C, D)
    xabcdAnnotation.setBasePoint(10, 30.6)
    xabcdAnnotation.setBasePoint(30, 31.5)
    xabcdAnnotation.setBasePoint(50, 30.3)
    xabcdAnnotation.setBasePoint(70, 31.5)
    xabcdAnnotation.setBasePoint(90, 30.6)
    
    // Allow to interact with the annotation in run-time
    xabcdAnnotation.setIsEditable(true)
    
    // Add the annotation to the AnnotationsCollection of a surface
    surface.annotations.add(xabcdAnnotation)
    
    Note

    For interactive creation of the XabcdAnnotation, use the XabcdAnnotationCreationModifier.

    Note

    To learn more about other Annotation Types, available out of the box in SciChart, please find the comprehensive list in the Annotation APIs article.

    Back to top © 2011-2025 SciChart. All rights reserved. | sitemap.xml