SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

1 vote


I’m creating a CustomChartModifier which I am able to hook to a SciStockChart (a template item in a SciChartGroup MVVM) and now I’m having difficulties in adding the BoxAnnotation to the Chart.

This is the code I’m using in my ChartModifier and placing a breakpoint shows me that indeed the code runs through this method, however, I do not see any BoxAnnotation on my chart? I’ve even tried adding the Height and Width properties without any further success. Other CustomModifiers to draw Lines and Ellipses works without problems. Do BoxAnnotations work differently?

I’m looking to have the the user be able to draw a BoxAnnotation on the chart, free hand / dynamically.


public override void OnModifierMouseDown(ModifierMouseArgs e)

        var resources = new AnnotationStyles();
        // x:Key="BoxAnnotationStyle" TargetType="s:BoxAnnotation"
        var style = (Style)resources["BoxAnnotationStyle"];

        _annotationCreation = new AnnotationCreationModifier () { AnnotationType = typeof(BoxAnnotation), AnnotationStyle = style };



<ResourceDictionary xmlns=""

<Style x:Key="BoxAnnotationStyle" TargetType="s:BoxAnnotation">
    <Setter Property="BorderBrush" Value="#279B27"/>
    <Setter Property="Background" Value="#551964FF"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="IsEditable" Value="True"/>

Thanks for any pointers or tips!

  • David T asked 6 years ago
  • last active 5 years ago
0 votes

I’m using boxAnnotation Object with some properties

I use
for resize and drag only x direction

It looks like drag and resize only x direction but the box resize y direction a little bit

I do not use any special properties using boxAnnotation

use of course .withIsEditable for editing
.withPosition, .withBackgroundDrawableId
that’ it

and I also wonder when i declare new CustomIResizingGrip object with new Canvas

why withDragDirections, withResizeDirections dont work?

  • cy bang asked 1 year ago
  • last active 12 months ago
0 votes

I’ve created a custom annotation and have set it’s .IsEditable property in code so the user can reposition it. I have two issues:
1.I want the user to be able to resize the “PPZLine” in the X direction, but I can’t figure out how to get the anchor points to appear.

  1. I want to be able to see the chart data that the annotation is covering. I tried setting AnnotationCanvas = BelowChart, but then I couldn’t move the annotation or get any annotation mouse handlers to trigger.

Here’s the annoation’s xaml:

<s:CustomAnnotation x:Class="CinchV2DemoWPF.Views.SciChart.PPZView"

             X1="{Binding X1}"
             Y1="{Binding Y1}"
             d:DesignHeight="300" d:DesignWidth="300">
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>

    <!-- price line must use margin 0,0 or obj will not be visible-->
        <s:BoxAnnotation Name="LongEntryMarker" Grid.Row="0"
                       Width="20"    Height="10"  Background="DarkViolet" Margin="0,0"  VerticalAlignment="Top" 

        <!-- long marker line MouseRightButtonDown="LongEntryMarker_OnMouseRightButtonDown"-->
        <s:BoxAnnotation Name="PPZLine" Grid.Row="1"
                       Width="150"    Height="5"  Background="red" Margin="0,0"  VerticalAlignment="Top" 
  • tecman234 asked 8 years ago
  • last active 6 years ago
0 votes


I figured out the problem. The reason why I did not see them was two-fold. The annotation view for some reason cannot infere the height of the parent (the chart) so setting match_parent as height doesn’t work and the view doesn’t have height. Second problem was that I have set .withPosition() with Y value as 0, and that would draw the view under the visible area of the chart.

So let me now ask new questions

1 Is there a possibility to move the annotation just by grabbing it, without first selecting it?
2 How can I change the red border when selecting the annotation?
3 How to set the annotation to return X value of it’s position from the center of its view and not from the start of its view
4 How do I restrict movement of the annotation to only X axis?

/// original question

I have a problem with annotations. What I need to achieve, is to draw custom view (it’s fairly simple) on my chart, and this view should have always the height of the chart.

I can’t make it work, I am adding the annotation in exact same way as in example android project, and I even copied annotation code from your example project to mine, but for some reason it doesn’t work in my project.

this is the drawable:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="">
<item android:width="40dp">
<color android:color="@color/secondary_18"/>
<item android:gravity="center_horizontal" android:width="4dp">
<color android:color="@color/secondary"/>

EDIT: There is no < br > in this code ^

what I already tried:
1. Wrapping the drawable into layout consisting of <ImageView> with src= set to drawable
2. Creating a class extending View() class and then setting the imageResource there
3. inflating my layout first and then putting it inside .withContent()
4. using .withContent() directly with R.layout.some_layout_view
5. using it with .withBackgroundDrawableId()
6. various combinations with setting different widths and heights and .withPosition() and whatever you can think of

I managed to display the CustomAnnotation once (don’t remember with which combination of settings) but it wouldn’t move anyway despite the .withIsEditable(true) and despite it was “selected” (red border around it appeared on click)

my axes:

        val xAxis = sciChartBuilder.newNumericAxis()

    val yAxis = sciChartBuilder.newNumericAxis()


my series:

 chartSurface.renderableSeriesAreaFillStyle = SolidBrushStyle(chartBackgroundColor)
    chartSurface.renderableSeriesAreaBorderStyle = SolidPenStyle(0x0, false, 0f, null)

    val mountainSeries = sciChartBuilder.newMountainSeries()
        .withStrokeStyle(SolidPenStyle(-0x1, true, 0f, null))
        .withAreaFillLinearGradientColors(-0x1, -0xed7422)


my control modifiers:

   val chartModifiers = sciChartBuilder.newModifierGroup()


one example of many of how I tried to add the annotations:


ofc I also tried the same with CustomAnnotation and like I said with various other settings I could think of like .withPosition() and withResizingGrip. Curious thing is that VerticalLineAnnotation works with no problems really.


Alternatively I could go with two VerticalLineAnnotations on top of each other moving together but I would have to be able to move them instantly, without selecting them first, because those circular handles look really bad and I have to disable them.

But later on I need to have box annotation working anyway, there will be X values selecting feature

1 vote

Hi, I am displaying no of BoxAnnotation , I want to link some of the BoxAnnotation randomly .I want to perform the operaton on annotation with relation.When it move BoxAnnotation,related link should also move accordingly.I am also performing Y axis with yaxisID so Annotation also move to Y direction with Y axis.
Please help me out.

0 votes

Dear support,

What is the best way to anchor a GroupBox to the top right corner of a SciChartSurface (as shown in the attached screenshot)? At the moment, I am using an absolute positioning that often fails at initialization or when the surface is resized. I am looking into the annotation API, but have not yet found a clean solution.

Thank you,

0 votes

How to change IsEditable behaviour for a annotation ?

Requirement is to allow Editing (Allow resizing box annotation only on X1 or X2 or Y1 or Y2 side).

It must be possible to specify which sides we can resize. (IsEditable on X1 or X2 or (X1 and X2) all combinations ). Because I’m programmatically creating box annotations.

0 votes


I have made the chart vertical by changing X axis alignment to left and Y axis alignment to bottom. After changing like this, im not able to resize the box annotation using all four resize adorners. Only two working, other two resetting Y1 value. below is the code snippet.

         X1="{Binding TopDepth, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
         X2="{Binding BottomDepth, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
         YAxisId="Top" />
         AxisTitle="Depth [ft]"
         FlipCoordinates="{Binding FlipYAxis}"
         TitleStyle="{StaticResource AxisTitleStyle}" />
         TitleStyle="{StaticResource AxisTitleStyle}" />

Can you please let me know what i’ve missed?


  • Sync Kumar asked 11 months ago
  • last active 10 months ago
0 votes

I am creating iOS aplication which displays charts based on stocks data.
I want to create box annotations to show when market is open or closed.
I am using CategoryDateTimeAxis to display data but when i add AnnotationCollection with BoxAnnotations to Surface i can not see the annotations.

This is my code for creating box Annotation:

    let pre = SCIBoxAnnotation()
    pre.coordinateMode = .relative
    pre.x1 = SCIGeneric(setDate(date, 4, 0, 0)!)
    pre.x2 = SCIGeneric(setDate(date, 9, 30, 0)!)
    pre.y1 = SCIGeneric(max )
    pre.y2 = SCIGeneric(0)
    pre.isEditable = false = SCISolidBrushStyle(color: #colorLiteral(red: 0.01680417731, green: 0.1983509958, blue: 1, alpha: 0.13)) = SCISolidPenStyle(color: .clear, withThickness: 0)
  • Marcin C asked 3 years ago
  • last active 3 years ago
0 votes

In WPF, I am trying to allow user to resize a box annotation by holding the mouse on its side edges and dragging the mouse to left or right. By default, the box annotation allows to resize only by its round shaped holders appearing on top corners. Is there any way to allow such functionality?

So far, I have thought of placing two vertical annotations inside the box annotation template exactly on its edges and then sync their X coordinates with that of the box by two way binding. However, it is not an easy way to do it and also it does not work when used together as a single custom annotation or composite annotation.

Please suggest if any property can be tweaked for box annotation to achieve this?

  • Anil Soman asked 2 years ago
  • last active 2 years ago
1 vote

I want to plot line chart on BoxAnnotation, so that BoxAnnotion become as a container.
i.e dataSeries.Append(100, 100);
dataSeries.Append(200, 150;
on BoxAnnotation
Please have a lool into the picture.

0 votes

To whom this may concern:

I am following up to an issue that I posted a few years ago:

I’ve attached a sample project that outlines what I am trying to accomplish. It is a simple scatter chart with randomized points in which I am trying to draw a rotatable ellipse annotation around the points.

The annotation inherits the “BoxAnnotation” class and replaces it’s template with an ellipse that is shaped to within the bounds of the annotation. This ellipse can be rotated by dragging the ellipse with the right-click button of the mouse. Upon doing so, in order to ensure the ellipse still maintains its shape when zooming in, the ellipse is converted to a geometric path. (Shown when the color of the ellipse changes from red to green.) Like this, when re-sizing the ellipse, it maintains its shape. After re-sizing, if the user wants to rotate the ellipse again, the original Ellipse UIElement re-surfaces and the Path UIElement is hidden. The user can then rotate the ellipse, which is in turn rendered back to a Path UIElement once again. The bounds of the annotation are modified to ensure the ellipse and its geometric path maintains its shape when switching between the Ellipse and the Path UIElements.

The issue is when re-sizing the annotation, and then attempting to rotate the ellipse again, the ellipse is clipped by the bounds of the annotation, even though “ClipToBounds” is set to false (in the code-behind). Unfortunately, I can’t find a pattern for which this occurs, and I have no solution to this issue. Examples of the clipped and non-clipped ellipses are shown in the attached images.

Hopefully the attached project is easy to understand. Can you please advise?

Thank you kindly!

— Ari

EDIT: Code attached as .ZIP file

  • Ari Sagiv asked 2 years ago
  • last active 2 years ago
1 vote

How to create custom annotation which has BoxAnnotation with a VerticalLine Annotation at one end.

At present I’m achieving this by creating both annotations and synchronizing them in ChartModifier.
Look at the attached image where you can see two BoxAnnotations both having a VerticalLineAnnotation at one end. I’m disabling editing for BoxAnnotation and enabling editing only for VerticalLineAnnotation.

When VerticalLineAnnotation is dragged in X-Direction, I get the X1 value from it and manually set it to BoxAnnotations X2.

This is not good implementation. I can see lag between sync events. Is it possible to create a custom annotation which incorporates both Box and Vertical line annotations ? Or is it possible to set IsEditing for BoxAnnotations One End only ?

0 votes

i wanna use vertical line annotation in box annotation that only one edge moves to drag like using ‘chart drag area to zoom’

I checked about custom annotation and there’s features said ‘common features of annotations’ but they don’t have any features l’m looking for

i put pictures for understanding.

there are box annotation on a graph and I want to move line to drag and box is going to smaller or larger

and i also want the other edge is fixed, it can not be dragged

do you guys have any tips for me?

  • cy bang asked 1 year ago
  • last active 1 year ago
2 votes

I want to have a BoxAnnotation where Y1 (- double.Infinity) and Y2 (+ double.Infinity). Basically I wanna specify only X1 and X2. And the behaviour must ensure always the box annotations Y1 & Y2 stretch to visible area even when I resize (zoomout) the chart.

In the screen shot its not stretched.

0 votes

I have the necessity to allow the user to draw one or several polygons upon a heatmap chart to let him select the region he is interested in. See attached image.

I don’t want to selected the markers inside the drawn polygon, only to know the coordinates (in data coordinates, not screen) of the various point that define the polygon.
I saw that the way to do this is to use Annotations however it’s not clear to me if is it possible to have the same behaviour of the BoxAnnotation but with a polygon (without any side number limit)?

Thank you,


0 votes

I used box annotation like pic
in a boxAnnotation I used

.withPosition(1,-2, 0, 2)

and i made a 2 box like pic

i use box for drag one side to make a box big or small

the first box which is left doesn’t move anywhere.
it just can only drag that i want
but the second box, the box moves when i drag after first touch
the left box never moves on but right box moves first drags
just move first time not sometimes

am i wrong something?

  • Justin Lee asked 11 months ago
  • last active 11 months ago
1 vote

Hi everyone,

What would be the easiest way of shading all vertical bands for weekend days? I’ve got two ideas:

  1. Setting major band brush won’t work because there’s no way of setting only weekend bands to be major bands (as far as I know).
  2. Using box annotations.

Problem with 2nd option is that annotations are rendered over the chart (screenshot attached). Is there a way of sending them behind columns?


  • Igor Peric asked 4 years ago
  • last active 4 years ago
1 vote

I’m trying to put together a chart that adds a bar at the bottom, to visualise Y values going over specific thresholds (in this example, below 20 is Green, 20 to 30 range is Yellow, and over 30 is Orange), as shown here:

The bar scales along with the line when zooming the chart

The version pictured builds the bar using box annotations, each defined as below:

new BoxAnnotationViewModel()
    X1 = currentXValue,
    X2 = currentXValue, + xValuesStepSize,
    Y1 = 0.96,
    Y2 = 1,
    Background = backgroundColor, //Colour calculated based on Y value
    AnnotationCanvas = AnnotationCanvas.AboveChart,
    CoordinateMode = AnnotationCoordinateMode.RelativeY

This implementation works, but the issue is that the bar is drawn inside the main chart area, and so covers some of the chart itself; if this could just be moved onto the X axis, rather than the chart canvas, then this would be exactly what I need.

I tried to just switch the canvas on the BoxAnnotations to use AnnotationCanvas.XAxis, but when doing this the annotations don’t seem to be getting the right X / Y coordinates for positioning – the width and height of each block looks correct, and the width scales when the chart is zoomed in, but every block appears to be positioned at 0,0 on the XAxis canvas (it looks like X1/Y1 values are ignored, so all blocks are stacked on top of each other in the same position rather than appearing alongside each other as a bar)
BoxAnnotationsOnAxis BoxAnnotationsOnAxisZoomed

With a bit of searching I found an old post ( stating that ‘AxisMarkerAnnotation’ is the only supported annotation for display on an axis canvas, so I tried using this instead, which does seem to respect the X1 position. Here though, the X2 value seems be be interpreted as just a static pixel width, and the width of the annotations does not scale when the chart is zoomed, so the blocks stay as whatever width is initially drawn and get moved further apart the more the chart is zoomed in.
AxisMarkerAnnotations AxisMarkerAnnotationsZoomed

I’m new to SciChart so hopefully I’m missing something obvious; is there any way of either getting the BoxAnnotation to work on an axis canvas, or of setting an AxisMarkerAnnotation’s width to be the width between two points on the X axis, scaling along with the chart when zooming?

I hope the above makes sense, thanks in advance for your help.

  • Tony Murphy asked 11 months ago
  • last active 11 months ago
0 votes

I am trying to use a BoxAnnotation to put an image on my graph. I am using BelowChart AnnotationCanvas so I can have the graph on top of the image. However, doing so also puts the grid lines on top of the annotation as well. Is there a way to keep the annotation below the chart but still keep it above the grid lines?

Showing 20 results
This template supports the sidebar's widgets. Add one or use Full Width layout.