Pre loader

How to draw Oval / Circle 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

1
0

I am considering applying server-side licensing for my javerScript application.

In the document below, there is a phrase “Our server-side licensing component is written in C++.”
(https://support-dev.scichart.com/index.php?/Knowledgebase/Article/View/17256/42/)

However, there is only asp.net sample code on the provided github.
(https://github.com/ABTSoftware/SciChart.JS.Examples/tree/master/Sandbox/demo-dotnet-server-licensing)

I wonder if there is a sample code implemented in C++ for server-side licensing.

Can you provide c++ sample code?
Also, are there any examples to run on Ubuntu?

  • You must to post comments
1
0

Hi Azrin,

You can draw an oval (Ellipse) annotation by templating the BoxAnnotation type to create any custom annotation.

Please see the following FAQ for instructions: Resizing a custom annotation

Best regards,
Andrew

  • You must to post comments
1
0

Hi Andrew,

Thanks for the reply. I’m just confused with the example given.Normally to create a custom annotation one would need to override the class

You have specified the following code:

<!--  Annotations  -->
<Style x:Key="AnnotationBaseStyle" TargetType="a:AnnotationBase">
    <Style.Setters>
        <Setter Property="IsTabStop" Value="False" />
    </Style.Setters>
</Style>

<!--  BoxAnnotation  -->
<Style BasedOn="{StaticResource AnnotationBaseStyle}" TargetType="a:BoxAnnotation">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="a:BoxAnnotation">
                <Border x:Name="PART_BoxAnnotationRoot"
                        Margin="{TemplateBinding Margin}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding CornerRadius}" />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Sounds it’s a bit far from getting an ellipse or circle from here.

can you help?

thanks

  • Andrew Burnett-Thompson
    Hi Azrin, the above code is an example to template the BoxAnnotation to make it look how you want. If you want an ellipse, simply put an ellipse in the template, e.g. <Style BasedOn="{StaticResource AnnotationBaseStyle}" TargetType="a:BoxAnnotation"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="a:BoxAnnotation"> <Border x:Name="PART_BoxAnnotationRoot" Margin="{TemplateBinding Margin}"> <!-- Any UI can go here! --> <Ellipse Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Width="{Binding ActualWidth, RelativeSource={RelativeSource FindAncestor, AncestorType=Border}}" Height="{Binding ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorType=Border}}" StrokeThickness="1" /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>
  • You must to post comments
0
0

Thanks Andrew,

It’s work perfectly fine.

I was using it in a drawing palette so I had to create a derived class

Cheers!

  • You must to post comments
0
0

I’m confused as to where these lines of code should go. You can’t really put a Style container directly in a <Scichart.Annotations> container. Why is the “BasedOn” property necessary?

I have a rudimentary code here just trying to make an ellipse within a box template:

<s:SciChartSurface>

    <s:SciChartSurface.Resources>
    </s:SciChartSurface.Resources>

    <s:SciChartSurface.XAxis>
        <s:NumericAxis AxisTitle="Time (s)" AutoRange="Always" Id="XAxis1"/>
    </s:SciChartSurface.XAxis>

    <s:SciChartSurface.YAxis>
        <s:NumericAxis AxisTitle="Temperature (C)" TickTextBrush="DarkOrange" Id="LeftAxis" AutoRange="Once" AxisAlignment="Right"/>
    </s:SciChartSurface.YAxis>

    <s:SciChartSurface.Annotations>
        <s:BoxAnnotation X1="1" X2="9" XAxisId="XAxis1" YAxisId="LeftAxis" Y1="1" Y2="9">
            <Style TargetType="s:BoxAnnotation">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="s:BoxAnnotation">
                            <Border x:Name="PART_BoxAnnotationRoot" Margin="0">
                                <Ellipse Fill="Red" Stroke="Blue" Width="20" Height="20" StrokeThickness="1"/>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </s:BoxAnnotation>
    </s:SciChartSurface.Annotations>

    <s:SciChartSurface.ChartModifier>
        <s:ModifierGroup>
            <s:RubberBandXyZoomModifier IsEnabled="True" IsXAxisOnly="False" ZoomExtentsY="False" IsAnimated="True"/>
            <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>
        </s:ModifierGroup>
    </s:SciChartSurface.ChartModifier>
</s:SciChartSurface>

The box template itself will show up, but nothing inside it. Can you please advise?

  • You must to post comments
Showing 4 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