I have two questions on rollover modifier.
One is the tooltip of the rollover is right under the finger on a heatmap chart. Can I move it to the top left section of the touch point?
Second question is how can I implement a callback function whenever Y axis of the rollover modifier changes?
Thanks for your attention in advance.
- Gang Xu asked 4 years ago
- You must login to post comments
Hi Gang Xu,
Regarding callback for Y value of tooltip – please take a look on Custom RolloverModifier example. Every time tooltip is updated there will be internalUpdate() call where you can put your code.
Regarding second part of question I don’t fully understand what you mean. Can you provide an example of desired output?
Best regards,
Yura
- Yura Khariton answered 4 years ago
- You must login to post comments
Hello Yura,
Thanks for your reply. I have two charts in my app, one is waveform chart, and the other one is heatmap chart. I want to execute a callback function when the thumb is moving on the heatmap. The callback function will update the waveform chart based on the x position of the tooltip on the heatmap chart.
I tried to override the handleMasterTouchDownEvent, but the point.x is not the tick on the x axis. Please advise.
- Gang Xu answered 4 years ago
-
Then I would suggest to go with internalUpdate() like I suggested in my first reply. You can pass second series into tooltip by injecting it in via constructor into SeriesInfoProvider and then from SeriesInfoProvider pass it into custom tooltip, where on update change wave series.
-
In handleMasterTouchDownEvent() ‘point’ parameter contains pixel coordinates of touch point relative to the center of chart. If I understand correctly you want to convert it to data value on axis. You can convert pixel coord to data value by using getDataValue(https://www.scichart.com/documentation/android/current/webframe.html#SciChart.Charting~com.scichart.charting.visuals.axes.IAxisCore~getDataValue.html) method.
-
Thanks Yura. I’ve figured out the solution with your help.
- You must login to post comments
Hi Yura,
I managed to use internalupdate() to achieve my goal. But I have another issue now.
In my code, the first chart is ECG line chart, and the second is a spectrogram heatmap chart. I added a vertical line annotation to the spectrogram chart. Whenever I move my finger on the spectrogram chart, the vertical annotation line will move along with the finger, and the ECG visible range will be updated according to the position of my finger on the spectrogram heatmap.
But the problem is the x value from heatmapInfo.getFormattedXValue() is not correct if I zoomed in the spectrogram heatmap before the maneuver.
Is there a way to fix that? Thanks.
public class CustomHeatmapDataProvider extends DefaultUniformHeatmapSeriesInfoProvider {
@Override
protected ISeriesTooltip getSeriesTooltipInternal(Context context, UniformHeatmapSeriesInfo heatmapInfo, Class<?> modifierType) {
if (modifierType == CursorModifier.class) {
return new CustomHeatmapTooltip(context, heatmapInfo);
} else {
return super.getSeriesTooltipInternal(context, heatmapInfo, modifierType);
}
}
private class CustomHeatmapTooltip extends UniformHeatmapSeriesTooltip {
public CustomHeatmapTooltip(Context context, UniformHeatmapSeriesInfo heatmapInfo) {
super(context, heatmapInfo);
}
@Override
protected void internalUpdate(UniformHeatmapSeriesInfo heatmapInfo) {
// TODO: incorrect value in zoomed view
double centerSecond = Double.valueOf(heatmapInfo.getFormattedXValue().toString()).doubleValue();
double startSecond = centerSecond - ecgStripWidth/2;
double stopSecond = centerSecond + ecgStripWidth/2;
if (startSecond >= 0 && stopSecond <= ecgDuration) {
ecgSurface.getXAxes().getDefault().setVisibleRange(new DoubleRange(startSecond, stopSecond));
ecmSurface.getAnnotations().get(0).setX1(centerSecond);
}
}
}
}
- Gang Xu answered 4 years ago
-
It looks like we had a bug in hit test for heatmap series. It should be fixed in v3.1.0.4341, which you can get from Maven ( here a link on instructions how to reference our AARs from Maven – https://www.scichart.com/documentation/android/current/webframe.html#Tutorial%2001%20-%20Adding%20SciChart%20libraries%20as%20dependencies.html )
-
BTW there is no need to parse xValue from formatted string. UniformHeatmapSeriesInfo has stored xValue ( https://www.scichart.com/documentation/android/current/webframe.html#SciChart.Charting~com.scichart.charting.visuals.renderableSeries.hitTest.UniformHeatmapSeriesInfo~xValue.html ). You can convert it to double by using our ComparableUtil helper ( https://www.scichart.com/documentation/android/current/webframe.html#SciChart.Core~com.scichart.core.utility.ComparableUtil~toDouble.html ) or just cast it to double if you use double xValues in data series ( otherwise you’ll need to cast it to TX type from data series and then convert it to double )
-
Thanks Yura, it works like a charm.
- You must login to post comments
Please login first to submit.