Pre loader

VerticalLineAnnotationViewModel is not showing any AnnotationLabel MVVM

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

Hello,

I’m trying to display a vertical line annotation on a chart using MVVM.

In order to make it work I’ve (All the INotifyPropertyChanged are managed via the BaseViewModel)

public class GraphSurfaceBaseViewModel : BaseViewModel
{
    /// <summary>
    /// A list of annotations
    /// </summary>
    public ObservableCollection<IAnnotationViewModel> Annotations { get; private set; }

 ...
}

I create annotation that way

Graph.Annotations.Add(new VerticalLineAnnotationViewModel()
            {
                X1 = TimeOfComment,
                ShowLabel = true,
                StrokeThickness = 2,
                XAxisId = "Xaxis",
                YAxisId = "Yaxis1",
                AnnotationLabels = new ObservableCollection<AnnotationLabel>() { new AnnotationLabel() {Text = "mon test", LabelPlacement = LabelPlacement.TopRight } }

            });

And the binding to the scichartsurface is :

<s:SciChartSurface   
...         
Annotations="{s:AnnotationsBinding Annotations}"            
</s:SciChartSurface>

I’ve double check that my x axis and y axis have the same ID as the annotation.
The problem is I want to display several annotation labels but they are not appearing. I suspect a problem via the AnnotationsBinding which is not taking the AnnotationLabels from the VerticalLineAnnotationViewModel.

What I got :
enter image description here

What I want (paint skill here):
enter image description here

For the what I want, I can draw a simple vertical bar by settings showLabel = false but I suppose that all the label I previously added to the
AnnotationLabels will not be shown, that’s why I let it.

Thank you for any help.

Renaud

Version
5.3
  • You must to post comments
0
0

Hi Renaud,

Thanks for your question.

This issue has been reported and resolved already. Please try the latest nightly build and let us know if everything works fine. Here is how to get SciChart’s Nightly build:
https://support.scichart.com/index.php?/Knowledgebase/Article/View/17232/37/getting-nightly-builds-with-nuget

Best regards,

Oleksandr Shvets
SciChart Technical Support Engineer

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.