SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

0
0

I have a method that adds a marker line to my chart. The issue I have it that calling this method results in a non-blocking async call but in other code where I call this, I want to access the markers immediately after adding the marker. Is there a way to call Annotations.Add synchronously?

public void CreateNewMarker(DateTime markerDate, Color color)
{
try
{
MainChart.Annotations.Add(new VerticalLineAnnotation()
{
Stroke = new SolidColorBrush(color),
StrokeThickness = 1,
X1 = markerDate,
StrokeDashArray = new DoubleCollection(new List { 6, 3 }),
IsEditable = false
});
}
catch (Exception ex)
{
Tracing.TraceError(piuModule, className + “.CreateNewMarker()”, “Error during the CreateNewMarker() method”, ex);
}
}

Other Method
{
calls CreateNewMarker(0
Access new marker Annotations by index, MainChart.Annotations[markerIndex].X1

}

Version
2.2
  • You must to post comments
0
0

Hi Raymond,

Thanks for your inquiry.
I am sorry for the misunderstanding. Adding Annotations is always a synchronous (blocking) call that is done in a UI thread.
You should be able to access the new annotation immediately after adding it.

We have also noticed there is no valid license assigned to your account.

If you wish to continue receiving technical support further please consider renewing your support subscription.
To do that please contact Sales here:
https://www.scichart.com/contact-us/

Or email us at sales@scichart.com

If you believe this is not correct please provide your new order details.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.