Programmatically show a tooltip in Android


I have crosshairs and tooltips (And custom tooptips) working fine on long press of a column chart series, but I would like to have an initial column selected with its tooltip showing on start up.

How would one show a tooltip programmatically in ShinobiChats for Android?

I was hoping it would be as simple as - after initializing a column series and adding that to my shinobi chart… just calling setFocus() or setActivated(), but neither are working (and none of the below works either).

DataPoint<?,?> dataPoint = (DataPoint<Double, Double>) cs.getDataAdapter().get(0);
        Crosshair crosshair= shinobiChart().getCrosshair();
        Tooltip tooltip = crosshair.getTooltip();

Anyone done this successfully?


Hi andrewvariable,

In ShinobiCharts for Android the only way to show the Crosshair is by performing a long touch gesture. As such, as you have seen, setFocus() and setActivated() won’t cause it to appear.

That said, the Android platform does allow you to programmatically fire MotionEvents so you could create one to effectivly do a long press for you. See (particularly the obtain method).

One thing to bear in mind is for a ColumnSeries (and BarSeries) the touch needs to be within the column (or bar) bounds. Also, the Axis.getUserValueForPixelValue() method will likely be handy for converting between user and pixel values.

Hope that helps!