It seems most of the modifiers bring up tooltip data with a pan, and then it goes away when the user lifts their finger. Is there any way to bring up tooltip data with a tap (and does not go away when the finger has lifted)? The main problem that we’re trying to solve is that we would like to be able to pan to look at the chart (and don’t want an axis pan), but would also like to bring up tooltip data.
- Bharathi vadde asked 3 years ago
- You must login to post comments
Hi there,
You can create a custom RolloverModifier and ignore touch up event ( don’t call super implementation ). Also you need to change touch down handler, because if there will be no touch up then there should be only one touch down event:
class CustomRolloverModifier extends RolloverModifier {
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;
}
}
Hope this will help you!
Best regards,
Yura
- Yura Khariton answered 3 years ago
- Thanks yura, for your quick response. It resolves my problem. Here I want to add two rollover-modifier to graph at time. I tried to add like this. private var rolloverModifier: CustomRolloverModifier? = null private var rolloverModifier1: CustomRolloverModifier? = null rolloverModifier = CustomRolloverModifier() rolloverModifier!!.setShowTooltip(showTooltip) rolloverModifier!!.setShowAxisLabels(showAxisLabels) rolloverModifier!!.setDrawVerticalLine(drawVerticalLine) rolloverModifier1 = CustomRolloverModifier() rolloverModifier1!!.setShowTooltip(showTooltip) rolloverModifier1!!.setShowAxisLabels(showAxisLabels) rolloverModifier1!!.setDrawVerticalLine(drawVerticalLine) Collections.addAll(surface.chartModifiers, rolloverModifier,rolloverModifier1) but i can see only rollover-modifier on graph.
- First of all you need to set ReceiveHandledEvent = true for second modifier ( https://www.scichart.com/documentation/android/current/webframe.html#SciChart.Charting~com.scichart.charting.modifiers.ChartModifierCore~setReceiveHandledEvents.html ), because by default if one modifier from modifier collection handles touch event, then others won’t handle them unless they explictly tell that they want to receive touch events that are already handled by other modifiers. This was made to prevent activating several modifiers at the same time. This should allow to show second modifier.
- BTW in this case both RolloverModifiers will be placed at the same point on screen, because on every touch RolloverModifier is be moved at last touch point ( unless you adjust it ), so you may end up with two overlapping modifiers.
- I am not able to maintain the gap between two rollover modifiers. Is there any way that i can handle two rollover modifiers on graph by touch event.Hear i tried to add two different custom modifiers but still both rollover modifiers are overlapping each other. I wanted to change the color of vertical line in rollover modifier.
- Well I told you that they will overlap unless you adjust coords to draw at. You can asjust it’s position by modifier point passed into updateCurrentPoint(https://www.scichart.com/documentation/android/current/webframe.html#SciChart.Charting~com.scichart.charting.modifiers.MasterSlaveTouchModifierBase~updateCurrentPoint.html). To change color try to update color of Paint used to draw vertical line – https://www.scichart.com/documentation/android/current/webframe.html#SciChart.Charting~com.scichart.charting.modifiers.RolloverModifier~getVerticalLinePaint.html, but you need to update it after you add modifier into chart modifier collection, because it will be overriden by chart theme.
- You must login to post comments
Please login first to submit.