Android - stock prices with real-time data streaming


Im trying to create a candlestick graph that will update every second with a new point.
So far adding a new point to my data adapter seems to be working…kind of.
The issue is for every point added the current graph layout squashes to make room. 
Instead I would like the ability to pan freely horizontally to see previously added points.
I’ve read this blog post…

Which sounds very similar to what I want.
“In this app, we wanted to demonstrate both the auto-scaling capability of the axes and of being able to pan freely while the streaming happens in the background.”

Its this bit I need to get better understanding of how to do and in android not ios.

Is it possible in android?




Hi Aidan.

I see what it is you are trying to achieve. Have you seen these blog posts? Whilst they will not directly address your axis range issue, they may provide some useful tips for streaming data with shinobicharts for Android:

Our Advanced Charting Kit for Android should help you achieve background (we refer to it as windowed) data loading. You can obtain a free trial from the following link:

Without the Advanced Charting Kit, you should still be able to improve the way your streaming app handles the data loading. Firstly, you could consider setting an explicit default axis data range using the following method:<T>)

This would mean that the chart would initially show a subset of your data, within this default range. As you have discovered however, as the next data point is loaded, the axis ranges would be recalculated to ensure that all of the data is shown. You can disable this behaviour using the following api method:

Depending upon how many data points your Series will have, you may find performance will degrade with streaming data. One of the reasons is that our SimpleDataAdapter informs any attached Series that it needs to redraw after the addition or removal of a single data point. This can result in a lot of drawing! Some users choose to implement their own DataAdapter, and take a more controlled approach to updating their series.

You can combine this with changes to the axis range from user gestures, with the help of this listener:

I hope that you find this information helpful.