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

Welcome to the SciChart Community Forums!

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.

1
0

Hi,

The new annotations looks great.
How can I add 2 vertical line annotations by code (mvvm)?
When on screen, how can I get the values of the two lines back in the viewmodel so I can display/calculate x and Y values of the chart?

Thanks…

  • You must to post comments
0
0

Hello there,

Please, take a look into attached example. It demonstrates vertical line annotations creation in ViewModel.
To get back value of line, you should bind to X1 property of anotation, or to LabelValue property of VerticalLineAnnotation (by default it is bind to X1). Also you can add more labels via VerticalLineAnnotation.AnnotationLabels property.

Also, you could look into DragHorizontalTreshold example.

Best regards,
Yuriy

Attachments
  • EJansen
    Hi, Thanks for the info. This works fine now, I can get the X value from the marker and display this on screen. If I have the X value, how can I get the Y value from the dataserie? Thanks....
  • Yuriy
    Hi, Please, try this:
    var index = series.FindIndex(xValue, BinarySearchMode.Nearest);
    var yValue = series[DataSeriesColumn.Y, index];
    
    Notice, that FindIndex isn't defined in IDataSeries interface, therefore, series should be cast to exact type or base type DataSeries. Best regards, Yuriy
  • David Adams
    I'm using SciChart in an ElementHost with Windows Forms. How do I get notifications of the vertical line annotation being dragged so that I can track X1?
  • Andrew
    Hi David, In SciChart v3.2, we have added the property AnnotationBase.DragDelta, which is fired when an annotation is moved. In previous version(s) of SciChart, you will need to set up a binding to VerticalLineAnnotation.X1 property
  • Robin Babicek
    Hi, any chance you could reupload that example? I’m getting a 404 when I click the link.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.