Pre loader

Tag: Annotations

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 vote
0 answers
9k views

Hi.

I am using BoxAnnotation in my project. When IsEditable attribute is set to true, there are four resizing grips available on the corners of the box.

The problem is that these grips are only visible when we click on the BoxAnnotation. I couldn’t find any available property to permanently display those resizing grips.

You can view this behavior in the Interaction With Annotations example.

Looking forward to a solution.
Thanks.

  • Ali asked 5 years ago
0 votes
12k views

Is it possible to scale annotations? I’ve included a couple screenshots. The first is our old, ugly legacy chart. The next few are SciChart. One challenge we have is to place labels on a chart at different locations relative to specific locations on the series. They need to be annotations that the user DOES NOT have permission to edit before he saves the chart to a PNG.

The purple and red lines on my chart look exceptional and “scale” correctly because their XY values scale as the chart is resized matching the series as it scales.

The red, purple and orange annotations however do not. I understand why it’s happening as I’m placing the annotations at exact locations via XY. So as I magnify or resize the window the XY doesn’t change; however, the original location of my annotation “appears to the user” to move. I understand that it’s not really moving as it is still located at the same exact XY where it was placed.

Is there a simpler way to scale it to a relative position during a window resize? Or am I stuck having to redraw the annotations as this happens?

0 votes
6k views

I need to update a lot of annotations. Not so much. Remove and add about 10-100 annotations per action. And it takes a lot of time. I’ve already tried all the recommendations with SusppendUpdates etc, but the result is the same.

I don’t need the flexibility of UIElements. I’m using it as markers only.

So, maybe it is possible to implement annotations as a series with a custom point marker. I need a vertical dashed line with text, like in screenshot. Is there a way to do it?

0 votes
8k views

To whom this may concern:

I am following up to an issue that I posted a few years ago: https://www.scichart.com/questions/wpf/resizing-custom-annotations

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 4 years ago
  • last active 4 years ago
0 votes
0 answers
7k views

I have created a composite annotation that consists of four elements: two VerticalLineAnnotations, a BoxAnnotation, and a TextAnnotation. When I first add the annotation, everything appears correctly. However, when I change between tabs in my TabControl… the BoxAnnotation disappears. The box will reappear when I move the composite annotation a few pixels.

Note: Calling ZoomExtents() or InvalidateElement() does not fix the issue.

I’ve created a simple app to reproduce the issue.

PeakAnnotation.xaml

<s:CompositeAnnotation x:Class="WpfPresentation.Views.PeakAnnotation"
                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" 
                DragDirections="XDirection"
                ResizeDirections="XDirection"
                IsEditable="True">

<s:CompositeAnnotation.Annotations>
    <s:VerticalLineAnnotation CoordinateMode="Relative" Stroke="#FFBADAFF" StrokeThickness="2" X1="0" X2="0" Y1="0" Y2="1"/>
    <s:VerticalLineAnnotation CoordinateMode="Relative" Stroke="#FFBADAFF" StrokeThickness="2" X1="1" X2="1" Y1="0" Y2="1"/>
    <s:BoxAnnotation x:Name="box" Opacity="0.2" CornerRadius="2" Background="#FFBADAFF" BorderBrush="#1964FF" CoordinateMode="Relative" X1="0" X2="1" Y1="0" Y2="1"/>
    <s:TextAnnotation x:Name="AnnotationTextLabel" CoordinateMode="Relative" X1="0" Y1="0.95" FontSize="12" Foreground="White"/>
</s:CompositeAnnotation.Annotations>

PeakAnnotation.xaml.cs

public partial class PeakAnnotation : CompositeAnnotation
{
    public PeakAnnotation()
    {

    }

    public PeakAnnotation(string annotationText)
    {
        InitializeComponent();
        AnnotationTextLabel.Text = annotationText;
    }

    public string StyleKey { get; set; }

    public Type ViewType => throw new NotImplementedException();
}

MainViewModel.cs

public MainViewModel()
    {
        ChartTitle = "Testing";

        Annotations = new AnnotationCollection();

        var myAnnotation = new PeakAnnotation("My Annotation Title")
        {
            X1 = 40,
            X2 = 50,
            Y1 = 0,
            Y2 = 100
        };

        Annotations.Add(myAnnotation);
    }
    public string ChartTitle { get; set; }
    public AnnotationCollection Annotations { get; set; }
}

MainWindow.xaml

<Window x:Class="SciChartTesting.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:SciChartTesting" xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
    mc:Ignorable="d"
    Title="MainWindow" Height="450" Width="800">

<Window.Resources>
    <local:MainViewModel x:Key="MainViewModel"/>
</Window.Resources>

<Grid DataContext="{StaticResource MainViewModel}">
    <TabControl>
        <TabItem Header="TabOne">
            <Label Content="This is TabOne"/>
        </TabItem>
        <TabItem Header="TabTwo">
            <s:SciChartSurface ChartTitle="{Binding ChartTitle}" Annotations="{Binding Annotations}">
                <s:SciChartSurface.XAxis>
                    <s:NumericAxis VisibleRange="0,100"/>
                </s:SciChartSurface.XAxis>
                <s:SciChartSurface.YAxis>
                    <s:NumericAxis VisibleRange="0,100"/>
                </s:SciChartSurface.YAxis>
            </s:SciChartSurface>
        </TabItem>
    </TabControl>
</Grid>

0 votes
10k views

Hi,

I am currently adding a Vertical Slice Modifier with just on Vertical Line inside of it.
The idea is to create a vertical cursor to display Y values for a given X value.
As my chart is a real time chart, I don’t want my cursor position changed expect on user interaction, I set to Relative the CoordinateMode property of my Annotation.

<s:VerticalSliceModifier Name="sliceModifier" ShowTooltipOn="Always" IsEnabled="True">
                    <s:VerticalSliceModifier.VerticalLines>
                        <s:VerticalLineAnnotation IsEditable="True" X1="0.5" Stroke="#D62D15" CoordinateMode="Relative"/>
                    </s:VerticalSliceModifier.VerticalLines>
                </s:VerticalSliceModifier>

The vertical line is correctly displayed at the centre of the surface but point markers and tooltips are not displayed at the line position, it seems the relative coordinate mode is not handle on this area.

Thanks for your help
Jean-Charles

0 votes
4k views

I downloaded the SciChartTeam SciChart version 6.4.0.13633 release from Git , thinking I would be able to get myself educated regarding Composite Annotations , which is something that has been requested by our field engineers.
The reference however given in the xaml file gives me :

Resources/ExampleSourceFiles/AnnotateAChart/CompositeAnnotations/CompositeAnnotationsView.xaml.txt

within the solution. That reference does not include any source files (see attached image)

Since Composite Annotations is fairly complex, code examples and a working example solution, showing Composite Annotations implemented would be extremely helpful for me. Is there a running example I can download / view/ interact with ?

Appreciate support in this matter

Thank you

Anders

0 votes
10k views

Hello SciChart-Team,
we had the requirement to show the zero line when there are negative values ​​in the chart.
We noticed the following things, especially in connection with the main grid lines.
There are some side effects at certain sizes of the window:
When the gridlines are on(see screenshot 1):
1. Grid line and tick are not on the same level (Only for certain sizes)
2. The grid line and horizontal annotation line (green) are not aligned either (Only at certain sizes)
3. The axis line (defined via BorderThickness) is also not aligned with the grid line (regardless of the size of the control).And the bottom tick is never aligned with the major grid line

If the major grid lines are switched off, the zero annotation line is not aligned to the ticks for certain sizes of the control (see screenshot 2)

It looks like different algorithms were used to calculate the line position of the ticks, grid lines and line annotations.

The problem was detected on the monitor with 100% scaling. On a 4K monitor with scaling > 100%, the problem became even more apparent

Do you have any suggestion how to solve the problem?

I’ve attached a modified example project in which the behavior can be reproduced.

Regards
Silvester Schneidt

0 votes
4k views

I’m using a chart as a way to visualise a series of time-based tasks on a “timeline”, not unlike a Gantt chart (is there anything SciChart can’t be used for?!). I do this using annotations that the user can move and resize, actually custom “box” annotations that can only be dragged and resized horizontally. Image attached if interested.

When a user starts moving or resizing an annotation, I bring it to the front to ensure that it remains visible even if it ends up overlapping another annotation, using:

Panel.SetZIndex(annotation, Int.MaxValue);
For every other annotation
    Panel.SetZIndex(annotation, 0);

Finding this approach was a bit of a happy accident so I’m wary of continuing to use this technique in case it breaks in a future version. I’m assuming this code works because annotations reside in a parent container that inherits from Panel? Do you see any issues using the above or is there a “better” way to change an annotation’s Z-Index?

0 votes
6k views

Greetings!

I am interested in drawing lines segments/cylinders on a WPF 3D plot in a manner that allows them to be selected or allow hit testing. I have looked at:

1) Selecting a vertex on a SciChart3DSurface, but I need to select the line
2) Drawing CylinderPointMarker3D’s but I need to set the length of each one

These lines only need to be drawn in the XY, XZ, and YZ planes so I have thought about using the ImpulseRenderableSeries3D but I need to control where the line segments start and end – and this doesn’t look like it allows control of the start.

Any ideas?

–Jonathan

1 vote
5k views

I need to serialize annotations. Not all the chart properties, but just Annotations.

I’ve tried to serialize the AnnotationCollection, as well as a List and neither works.

  • kelias asked 8 months ago
  • last active 8 months ago
1 vote
3k views

Hello,
I’ve got Annotations ViewModels collection (BoxAnnotationViewModel, VerticalLineAnnotationViewModel, LineAnnotationViewModel) bound by AnnotationsBinding. Every Annotation ViewModel has properties set to:

CoordinateMode = AnnotationCoordinateMode.Absolute
IsEditable = true
DragDirections = XyDirection.XYDirection
ResizeDirections = XyDirection.XYDirection

My goal is to move and resize every annotation on SciChart surface only by integer value. Is there any way to achieve this?

Best regards,
Anna

1 vote
2k views

When I put localized text in my annotations, and the user selects a different language while the chart is showing, do I have to rebuild my annotations?
I had hoped that I could register ‘globalized’ texts in my annotation object, and localize them in the getter method, but it seems that the getter method is not called every time the annotation text is displayed in a ToolTip

0 votes
5k views

Hi,

I’m trying to add a small image as an annotation to the chart, but I couldn’t make it work… most likely doing something wrong, but I can’t quite figure out how this should be done. This is the direction I went for:

public void AddIcon()
    {
        Image image = new Image();
        BitmapImage icon= new BitmapImage();
        icon.UriSource = new Uri(@"D:\icon.png", UriKind.Absolute);


        image.Source = icon;

        var annotation = new CustomAnnotation()
        {
            X1 = 0,
            Y1 = 0,
            Content = image,
        };
        ChartAnnotations.Add(annotation);
    }

What am I doing wrong? is there a proper and simple way to add image annotations to the chart in an MVVM manner?

Thank you!

  • Ilan Rozen asked 4 years ago
  • last active 1 year ago
1 vote
12k views

Hello!

Please take a look at the attached screenshot first.

I have a chart configured to draw real-time trading data. X axis type is DateTime. Y axis type is Float. I need to draw vertical expiration time line.

I tried to draw coordinate relative line annotation as follows:

var date: NSDate = NSDate()

let lineAnnotation = SCILineAnnotation()
lineAnnotation.xAxisId = self.axisXId
lineAnnotation.yAxisId = self.axisYId
lineAnnotation.coordMode = .SCIAnnotationCoord_RelativeX
lineAnnotation.style.linePen = SCIPenSolid(color: Style.Chart.ExpirationDateLine.Color, width: Style.Chart.ExpirationDateLine.Width
lineAnnotation.xStart = SCI_constructGenericTypeWithInfo(&date, .DateTime)
lineAnnotation.xEnd = SCI_constructGenericTypeWithInfo(&date, .DateT            

self.chartSurface.annotation = lineAnnotation
self.chartSurface.invalidateElement()

I tried to play with different coordMode values. Line does not appear. Could you help me with this task?

2 votes
9k views

From your documentation:

4.9 Annotations

SciChart features a rich Annotations API, that allows you to place UIKit UIElements over the chart.
SciChat provides a number of built-in annotations, but you can also create your own.

SCIBoxAnnotation, SCILineAnnotation and SCITextAnnotation are cool, but sometimes it’s not enough.

Is it possible to render UIView on the chart (at least UIImage)?
Is it possible to draw dashed line annotation?
Could you provide an example of creating custom annotation class?

1 vote
7k views

Is it possible to disable editing annotations via user drag?

0 votes
7k views

Hi there.

It’s has been asked here:
https://www.scichart.com/questions/question/custom-annotation

So, Is it possible to draw dashed line annotation at the current version 1.2.3.982?

Best regards,
Sushynski Andrei

0 votes
13k views

Hi,

I am working on a live graph similar to the sparse impulse series 3D and would like to add live annotations to the plotted data points to display the Y axis value.

Does the SciChart3DSurface support annotations?

If not I would like to instead use the TooltipModifier3D, but would like to force the tooltip to be displayed all the time and reduce the amount of data displayed to a single Y-Axis value. Does this sound reasonable.

Thanks

Marc

0 votes
10k views

When I enter PathAnnotation in the xaml, I get the error “The type ‘s:PathAnnotation’ was not found.” I do have the following Annotation types available:
– AxisMarkerAnnotation
– BoxAnnotation
– CustomAnnotation
– HorizontalLineAnnotation
– LineAnnotation
– LineArrowAnnotation
– SeriesValueAxisMarkerAnnotation
– TextAnnotation
– VerticalLineAnnotation

I want to be able to make a star shape annotation, and PathAnnotation seemed to be the only way to do this. Please let me know if there’s another way to do this.

Thanks,
Rachel

0 votes
0 answers
8k views

Hi,

I would like to know if there’s a way to show a list of Annotations for which the coordinates are stored in lists in my c# code. I can bind the items in the lists like this:

s:SciChartSurface.Annotations …>
s:CustomAnnotation X1=”{Binding XList[0]}” Y1=”{Binding YList[0]}” …/>
s:CustomAnnotation X1=”{Binding XList[1]}” Y1=”{Binding YList[1]}” …/>
s:CustomAnnotation X1=”{Binding XList[2]}” Y1=”{Binding YList[2]}” …/>
s:CustomAnnotation X1=”{Binding XList[3]}” Y1=”{Binding YList[3]}” …/>
/s:SciChartSurface.Annotations …>

Is there a way to do this with something like ItemsControl?

Thanks,
Rachel

0 votes
10k views

Hi,

I’m trying to follow the instructions here: https://www.scichart.com/documentation/v5.x/Tutorial%2007%20-%20Adding%20Annotations.html
to create a subclass of CustomAnnotation. I have copied the attributes given in the example (VerticalAnchorPoint=”Bottom” HorizontalAnchorPoint=”Center”) but I still get the error “An attribute name is missing” on anything I put after the attributes. Are there other attributes that may be required for CustomAnnotation, not given in this example?

Thanks,
Rachel

0 votes
7k views

Hello Everyone,

I have set up a few annotations in my project and set their visibility to hidden.
I am displaying only the selected one from a combobox I have set up for the user.
But each time the chart does ZoomExtents. all the annotations appear and their visibility resets to visible.
Is this intentional?
Can I disable this option?

Thank you in advance.

Showing 51 - 74 of 74 results