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.

0
0

Hi,
I am developing a candle stick chart, with modifier newModifierGroupWithDefaultModifiers
What i want to do is
1. when user click the chart, the modifier will be changed to CursorModifier,
2. xy axis label should not disappeared when user release their finger

How could i do that?

Thank you

Version
Trial
  • You must to post comments
0
0

Hi Tommy,

Thanks for writing to us.

Well nothing of this is available out of the box but you can create custom modifiers to provided desired behavior.

  1. You can create a separate modifier which listens to touch event and when click occurs it enables CursorModifier:

    class ActivateCursorModifier extends GestureModifierBase {
    private final CursorModifier cursorModifier;
    
    ActivateCursorModifier(CursorModifier cursorModifier) {
        this.cursorModifier = cursorModifier;
    
        // intercept handled touch events
        setReceiveHandledEvents(true);
    
        // disable modifier
        cursorModifier.setIsEnabled(false);
    }
    
    @Override
    public boolean onSingleTapUp(MotionEvent e) {
        // enable modifier after click
        cursorModifier.setIsEnabled(true);
        return true;
    }
    }
    
  2. You can customize CursorModifier to prevent hiding it’s tooltips and override its onTouchDown() which shows tooltips and onTouchUp() which hides tooltips:

    class CustomCursorModifier extends CursorModifier {
    private boolean isFirstTouch = true;
    
    @Override
    protected boolean onTouchDown(ModifierTouchEventArgs args) {
        // place tooltip on first touch only and ignore other touch down events because tooltip should remain on screen
        if(isFirstTouch) {
            isFirstTouch = false;
            return super.onTouchDown(args);
        } else
            super.onTouchMove(args);
        return true;
    
    }
    
    @Override
    protected boolean onTouchUp(ModifierTouchEventArgs args) {
        // ignore touch up event
        return false;
    }
    }
    

Is this suitable for your needs?

Hope it will help you.

Best regards,
Yura

  • You must to post comments
0
0

Thanks! Your code is really helpful
May I ask how to modify the axis label of the cursor? I cannot find any public interface to change it

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.