var annotationMax = new HorizontalLineAnnotation () {
Stroke = new SolidColorBrush (Colors.DarkRed),
HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
Y1 = item.MaxBandwith,
Y2 = item.MaxBandwith,
X1 = item.FromWavelength,
X2 = item.ToWavelength,
};
var label = annotationMax.AddLabel ();
after last line label is null
???
- Domas Markevicius asked 5 years ago
- You must login to post comments
What are you trying to do?
This is the preferred way to add a label to the HorizontalLineAnnotation:
https://www.scichart.com/documentation/v5.x/The%20HorizontalLineAnnotation%20Type.html
Best regards,
Andrew
- Andrew Burnett-Thompson answered 5 years ago
- last edited 5 years ago
- You must login to post comments
Sorry for long delay. I have my annotations databound to viewmodel’s AnnotationCollection, hence I am creating them there, not in XAML. I am trying to add label to HorizontalLineAnnotation, this annotation later is added to AnnotationCollection. Your example does not show such scenario and I do not understand why AddLabel method returns null.
Anyway, I solved this problem by simply modifying AnnotationLabels collection.
var annotationMin = new HorizontalLineAnnotation () {
Stroke = new SolidColorBrush (Colors.DarkRed),
HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
Y1 = item.MinBandwith,
Y2 = item.MinBandwith,
X1 = item.FromWavelength,
X2 = item.ToWavelength,
};
var label = new AnnotationLabel {
Text = "Min Spectral Bandwidth: " + item.MinBandwith.ToString ("0."),
HorizontalAlignment = System.Windows.HorizontalAlignment.Center
};
annotationMin.AnnotationLabels.Add (label);
- Domas Markevicius answered 5 years ago
- You must login to post comments
Please login first to submit.