SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.
I would like to position a textannotation in the middle of the chartarea (horizontal and vertical).
I’m using the following code, but is doesn’t work:
TextAnnotation textAnnotation = new TextAnnotation(); textAnnotation.Text = "Initializing"; textAnnotation.X1 = (double)xAxis.VisibleRange.Min; textAnnotation.X2 = (double)xAxis.VisibleRange.Max; textAnnotation.Width = (double)textAnnotation.X2 - (double)textAnnotation.X1; textAnnotation.HorizontalAlignment = HorizontalAlignment.Center; textAnnotation.HorizontalContentAlignment = HorizontalAlignment.Center; textAnnotation.Y1 = ((double)yAxes.VisibleRange.Max + (double)yAxes.VisibleRange.Min) / 2; textAnnotation.XAxisId = xAxis.Id; textAnnotation.YAxisId = yAxes.Id; textAnnotation.BorderBrush = Brushes.Black; textAnnotation.BorderThickness = new Thickness(1); this.Annotations.Add(textAnnotation);
We actually support centre placement of text out of the box. Can you try setting CoordinateMode.Relative then set HorizontalAnchor/VerticalAnchorPoint to central and finally X1,Y1 only to 0.5.
Please see the Annotations Are Easy article for a thorough definition of the properties on Annotations.
Please login first to submit.