After reading the example annotation code and articles in the forum, I still can’t find a way to achieve my purpose: My app has a thread to receive data sent by a server, the data may trigger an annotation created lively. My app also need to maintain all created annotations and change their properties like X/Y values or remove them later. So far I only see the way of creating annotation by clicking some button. I tries different ways but failed.
Please help me out with some detailed guides. I am a beginner for WPF.
I try to do this in user thread:
LineAnnotation annotationBase = new LineAnnotation();
change annotationBase properties.
But get this exception:
2014-11-09 13:42:20,623  ERROR WpfApplication2.MainWindow [(null)] – at System.Windows.Input.InputManager..ctor()
at WpfApplication2.InstrumentViewModel.addZone() in c:\Users\jokeslala\Documents\Visual Studio 2013\Projects\WpfApplication2\WpfApplication2\InstrumentViewModel.cs:line 134
at WpfApplication2.InstrumentViewModel.addMA20(Int32 barIdx, Double ma) in c:\Users\jokeslala\Documents\Visual Studio 2013\Projects\WpfApplication2\WpfApplication2\InstrumentViewModel.cs:line 128
at WpfApplication2.MainWindow.processEMA(String str) in c:\Users\jokeslala\Documents\Visual Studio 2013\Projects\WpfApplication2\WpfApplication2\MainWindow.xaml.cs:line 222
at WpfApplication2.MainWindow.consumeQueue() in c:\Users\jokeslala\Documents\Visual Studio 2013\Projects\WpfApplication2\WpfApplication2\MainWindow.xaml.cs:line 155
- You must login to post comments
Thank you for your question & comment. I think the problem you are seeing is that you are creating Annotations on a non UI thread (guessing?). If so, sorry, you have to create Annotations on the UI thread.
Why? Because Annotations are WPF FrameworkElements, and require that they are created on the UI thread.
In your comment you suggest another way and talk about performance. You can try using our PointMarker API and the XyScatterRenderableSeries. This allows rendering of many more points.
For tooltips / mouse-over, please see the TooltipModifier.
- HI Andrew, Thanks for your reply. Basically I try to find a way to draw a segment (x1, y1) to (x2, y2). The x-Axis is type of CategoryDateTimeAxis. I can't find an example for XyScatterRenderableSeries. looks it is not parameter-based, I can't create a class like XyScatterRenderableSeries<DateTime, double>. How to add the pointers (x1, y1) to the series?
- If you want to add a segment from (x1, y1) to (x2, y2), I suggest using our LineAnnotation type. Please see the article Annotations Are Easy! for guidance. https://www.scichart.com/annotations-are-easy/ Best regards, A
- HI, performance will be bad if use LineAnnotation right? I will have many many these items.
- Depends, If you have up to 1000 LineAnnotations it will be ok. 10,000 it will not be so fast. I suggest trying it. The Annotation API is the most easy API to use for line segments. The only other way is to use FastLineRenderableSeries. You can declare one series and have many segments by using double.NaN for a 'null value'. Take a look at our Gaps In Series example which uses double.NaN to display a gap between two points. https://www.scichart.com/Abt.Controls.SciChart.SL.ExampleTestPage.html#/Abt.Controls.SciChart.Example;component/Examples/IWantTo/CreateMultiseriesChart/GapsInSeries.xaml Best regards, Andrew
- Thanks Andrew. I will be trying it.
- You must login to post comments
Please login first to submit.