I would like to add scroll listener on x axis title. Is it possible to add scroll to axis title
- Vinu Gilbert asked 2 years ago
- last edited 2 years ago
- You must login to post comments
Hi there,
Unfortunately we don’t provide listener for scrolling on axis title out of the box. The closest behavior which we provide out of the box are XAxisDragModifier/YAxisDragModifier. They modify VisibleRange of axis when you perform scroll gesture inside axis rect. These modifiers are implemented as custom ChartModifiers which listens to touch events from entire chart, but change VisibleRange only if touch event is within axis bounds. So theoretically you can use similar approach to perform some custom action instead of changing VIsibleRange.
May I ask what are you trying to achieve? Why do you need scrolling on axis title?
Best regards,
Yura
- Yura Khariton answered 2 years ago
- Thankyou for your response. I’ve already added the drag listeners. Here What i am trying to acheive is to increase the area of touch , so that it will be easy to the drag listener .Ill attach a screen shot.
- You must login to post comments
Hi there,
If you’re using X/YAxisDragModifier and want to increase touch area, you can set MinTouchArea property on this modifier. In this case modifier should extend touch area in horizontal/vertical direction by specified amount of pixels.
Is this suitable for your needs?
Best regards,
Yura
- Yura Khariton answered 2 years ago
- You must login to post comments
Hi ,i’ve tried adding some values to XAxisDragModifier,but it didn’t make any change on touch area.I think set some wrong values.i’ll share code snippet
val xAxisDragModifier = XAxisDragModifier()
xAxisDragModifier.dragMode = AxisDragModifierBase.AxisDragMode.Pan
xAxisDragModifier.clipModeX = ClipMode.None
xAxisDragModifier.minTouchArea= 100f
its not increasing or decreasing the touch area. What am i doing wrong here?
- Vinu Gilbert answered 2 years ago
- Can you try setting bigger minTouchArea ( I just tried to set 500f and it worked for me )? As I see you set 100f which will be equal to 100 device pixels. Can you try to set minTouchArea in device independent pixels ( e.g. you can use DisplayMetrics to do conversion )? If you have screen with high DPI value this could result small touch area on screen. Also do you use some other modifiers? If yes, then it’s possible that some other modifier handles touch events before they reach XAxisDragModifier. In this case try to set xAxisDragModifier.receiveHandledEvents = true
- You must login to post comments
Please login first to submit.