Draggable horizontal Line in Android



I am new with shinobi charts, I would like to know if it is posible to create a draggable horizontal line (in Android).

My use case is similar to the Android system Data usage limit.

If not possible, is it posible to get the efective plot height (excluding titles, axis labels, etc) I tried using shinobiChart.getPlotAreaRect().height(); and it always returns 0 (no idea why)

Thanks in advance


Hi amantaut,

It sounds like you could use the Annotations feature for this - you can easily create a horizontal line annotation and then you should be able to get at the Annotation’s View and manipulate its X and Y values based on user interaction.

Either way, to get a meaningful result for the getPlotAreaRect() method, you need to call this after the chart has been laid out (otherwise you will get values of 0 for the height and width). We provide the ShinobiChart.OnInternalLayoutListener callback interface to allow you to be notified when the chart has been laid out and thus when you can call this method and get a meaningful result. The same goes for the getPixelValueForUserValue() and getUserValueForPixelValue() methods on the Axis.

Do bear in mind that the Rect returned by getPlotAreaRect() is relative to the ChartView’s position.

Hope that helps!