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 :
What I want (paint skill 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
- Renaud Danniau asked 6 years ago
- You must login to post comments
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
- Oleksandr Shvets answered 5 years ago
- You must login to post comments
Please login first to submit.