I want to add annotations programmatically. I need to add line with arrow and textbox at Y1 and X1 of a line. It creates pointed annotation.
- You must login to post comments
(I’m fairly new with SciChart myself, so I’m not sure if this is the best way to do it…)
You can look at what I’m building for a start. (Functional, but no comments yet. Hopefully the names are obvious enough)
I’m sure there will be a few extensions missing, but hopefully it’ll be obvious what they do.
When you add an annotation, it will show the textbox and tail pointers at an offset from the referenced data point.
When you zoom in and out and pan around, the annotation components will retain their relative size and offset to the point.
In edit mode, you can drag the text and reference points to new locations.
Here are two of the main extensions I know of:
public static void AddHandler(this DependencyProperty prop, object component, EventHandler handler)
{
DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(prop, component.GetType());
if (dpd != null)
dpd.AddValueChanged(component, handler);
}
public static void AddHandler(this object component, DependencyProperty prop, EventHandler handler)
{
DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor.FromProperty(prop, component.GetType());
if (dpd != null)
dpd.AddValueChanged(component, handler);
}
- dwoerner answered 10 years ago
-
Can't find Utilities.Extensions; Utilities.Extensions.XDocument; Utilities.XML.Serialization;
- You must login to post comments
Hi guys,
To add annotations programmatically, just create an annotation in code, set up all desired properties and add it to the SciChartSurface.Annotations collection. For reference, please take a look at the Histogram example from this thread.
UPDATE:
To create annotations at the mouse cursor position, please take a look at the Create Annotations dynamically example.
Basically, you should use the AnnotationCreationModifier for this purpose.
Hope it helps! If you have any questions, feel free to ask,
Best regards,
Yuriy
- Guest answered 10 years ago
- last edited 10 years ago
-
Yeah, I tried this method. But I need that X and Y points to be added with mouse directed place on chart.
-
Please see my updated answer. Does it work for you?
- You must login to post comments
Please login first to submit.