Pre loader

CustomAnnotation combined with multiple annotation

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

0
0

I would like to create custom annotation combined with multiple annotations like attached picture.(Text + box + line * 3)

Are there any good solutions?

Now I am creating it with separate each annotations showed code below. In this way, it is difficlt to move or delete them with group.

        <s:SciChartSurface.Annotations>
            <s:TextAnnotation Foreground="Black" 
                              HorizontalAnchorPoint="Center"
                              VerticalAnchorPoint="Bottom"
                              Text="XXX um" 
                              X1="90" 
                              Y1="6" />
            <s:BoxAnnotation X1="84" X2="96" Y1="2" Y2="11" Background="#77FFFFFF" />

            <s:LineAnnotation Stroke="Black" X1="85" X2="95" Y1="3" Y2="3"/>
            <s:LineAnnotation Stroke="Black" X1="85" X2="85" Y1="6" Y2="3"/>
            <s:LineAnnotation Stroke="Black" X1="95" X2="95" Y1="6" Y2="3"/>
        </s:SciChartSurface.Annotations> 

And one more question.

How to catch the event of adding annotation of view side from viewmodel?

Thank you.

Version
5.4
Images
  • You must to post comments
0
0

Hi Yukata,

Yes! We have a feature for this called Composite Annotations. Check it out here:

https://www.scichart.com/example/wpf-chart-example-composite-annotations/
https://www.scichart.com/documentation/v5.x/The%20CompositeAnnotation%20Type.html

enter image description here

<s:CompositeAnnotation x:Class="SciChart.Examples.Examples.AnnotateAChart.CompositeAnnotations.MeasureX.MeasureXAnnotation"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
                  Canvas.ZIndex="1">

   <s:CompositeAnnotation.Annotations>
      <s:BoxAnnotation Background="#FFBADAFF" CoordinateMode="Relative" Opacity="0.3"
                   X1="0" X2="1" Y1="0" Y2="1" />
      <s:LineArrowAnnotation CoordinateMode="Relative"
                        Stroke="#FFBADAFF"
                        StrokeDashArray="2,4"
                        StrokeThickness="1"
                        X1="0"
                        X2="1"
                        Y1="0.5"
                        Y2="0.5" />
      <s:LineAnnotation CoordinateMode="Relative"
                    Stroke="#FFBADAFF"
                    StrokeThickness="1"
                    X1="0"
                    X2="0"
                    Y1="0"
                    Y2="1" />
      <s:LineAnnotation CoordinateMode="Relative"
                    Stroke="#FFBADAFF"
                    StrokeThickness="1"
                    X1="1"
                    X2="1"
                    Y1="0"
                    Y2="1" />
      <s:TextAnnotation x:Name="MeasureText"
                    Background="CornflowerBlue"
                    CoordinateMode="Relative"
                    CornerRadius="3"
                    Foreground="White"
                    HorizontalAnchorPoint="Center"
                    X1="0.5"
                    Y1="1"/>
   </s:CompositeAnnotation.Annotations>

</s:CompositeAnnotation>

This allows you to create one annotation which is a group and set X1Y1 X2Y2 once. Also you can add/remove the entire composite at once.

Please have a look and let me know what you think!

Best regards,
Andrew

  • You must to post comments
0
0

Thank you very much. Your answer helped me.

How about the answer of another question below:

“How to catch the event of adding annotation of view side from viewmodel?”

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies