Pre loader

programatically setting cursor position

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I have 3 charts in my stock trading application. Each chart show a different time frame of data. I want to move the mouse on one chart, and have the other two charts put their cursors on the bar that represents the same DateTime and value of the chart that has the mouse. I have this logic working with my current charting software(not Scichart).

In Scichart, it seems I need to either be able to set the position of the cursor modifier programatically, or create a horizontal & vertical line annotation on the charts that don’t contain the mouse.
Is there a way to set the cursor modifier coordinates?

thanks!

  • You must to post comments
0
0

Hello there,

No there isn’t a way to do this programmatically, but you can always create custom modifiers to do pretty much anything. Do you have a source-code license? If so this process is greatly simplified. The modifiers have methods like OnModifierMouseMove, OnModifierMouseUp, OnModifierMouseDown.

The CursorModifier specifically responds to OnModifierMouseMove. It is possible you could create a derived class of CursorModifier and override OnModifierMouseMove and by-pass it, but this would disable mouse-movement.

For instance:

public class CursorModifierEx : CursorModifier
{
    public bool IsManualMode { get; set; } // Todo: Make dependency property

    public Point MoveToPoint 
    { 
       get { return _moveToPoint; }
       set 
       { 
          _moveToPoint = value; 
          OnMoveToChanged(_moveToPoint); 
       }
    } // Todo: Make DependencyProperty 

    public void OnModifierMouseMove(ModifierMouseArgs e)
    {
       if (!IsManualMode) 
         base.OnModifierMouseMove(e); // Prevent MouseMove from going to base class
    }

    private void OnMoveToChanged(Point manualPoint)
    {
       if (IsManualMode) 
         base.OnModifierMouseMove(new ModifierMouseArgs()); // Todo, pass in mouse point here
    }
}

I haven’t compiled the above but it should give you an idea of how you can modify the behaviour of the ChartModifierBase derived classes.

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies