SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & 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!

Answered
2
0

Hi, in the Dynamically Create Annotations demo, the method on how annotations are created is by (for example a line):

1) First Click on the annotation button
2) Click on the SciChart Surface. This creates the first point of a line
3) Click again on the end point of the line.

Instead of having to do two clicks, is there a way to click and drag instead? eg.

1) First Click on the annotation button
2) Click on the SciChart Surface. This creates the first point of a line
3) drag to the end point of the line.

I just want to mimic Microsoft power point behaviour as our users are more familiar with it.

Thanks

  • You must to post comments
Best Answer
1
0

This is useful, our users also complained about the nonstandard two click process to add annotations. However using this modification causes a crash upon adding HorizontalLineAnnotation and VerticalLineAnnotation, and TextAnnotation does not work either. As these annotations work fine with 1 click, there is an easy workaround for this of course:

public class CustomAnnotationCreationModifier : AnnotationCreationModifier
{
    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        if (AnnotationType != typeof (TextAnnotation)
            && AnnotationType != typeof (HorizontalLineAnnotation)
            && AnnotationType != typeof (VerticalLineAnnotation))
        {
            OnModifierMouseUp(e);
        }
    }
}
  • You must to post comments
1
0

Hi Azrin,

Thanks for writing to us. To achive desired behavior please try to create custom AnnotationCreationModifier with next code:

public class CustomAnnotationCreationModifier : AnnotationCreationModifier
{
    public override void OnModifierMouseDown(ModifierMouseArgs e)
    {
        OnModifierMouseUp(e);
    }
}

By default AnnotationCreationModifier uses only mouse up event. When first mouse up occurs – modifier creates and places annotation, on second mouse up – annotation is fully created and AnnotationCreated event fires. With provided code – annotation is created when mouse down occurs and AnnotationCreated event is raised on mouse up event.

Is this approach suitable for you? Hope it helps!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.