I am trying to chart data in real-time from an external source -- in this case, a Bluetooth device -- that is streaming values to me.
Is this possible? I can't seem to figure out how to do this. I'd like to add a new datapoint to the end of a datasource, and remove the first datapoint, etc.
7 Answers, 1 is accepted
Assuming that you have the data flowing from the bluetooth device and change it at a given interval, the Telerik Chart can cover your scenario. For more information, please refer to the Chart >> Live Data example of the Demo app that ships with the Telerik UI for iOS suite. You can also check the Building a Seismograph App with CoreMotion, Swift and Telerik UI for iOS blog article which covers a similar scenario where the data is taken from the device accelerometer.
I hope this helps.
Regards,
Nikolay
Telerik
While that example does show live data loading, the requirement to call removeAllData() and then re-build the chart is problematic when the data comes in slowly, as over Bluetooth. The device only sends updates every second or so, which means that the re-draw is awful looking. because it is re-drawing the entire chart, rather slowly, every few seconds. Not a smooth look at all.
Currently the only option to update TKChart in this scenario is by calling removeAllData method. However, this should not cause issues when your data is updated every few seconds. Could you, please prepare a sample application. We will analyse it in detail and we will try to find a proper solution.
There is an issue logged in our feedback portal related with this scenario. Use the following link to track its status and vote/comment on it.
Looking forward to your reply.
Regards,
Jack
Telerik
Crude app that shows the problem. Data is simply inserted after a timer fires every 2.5 seconds ...
You can download the Xcode project at https://davidgs.com/TelerikTest.zip
Best regards,
dg
I am not able to open the link. Could you, please upload the file again? Looking forward to your reply.
Regards,
Jack
Telerik
The link works now. I checked your code. The redraw issue is caused by the animations in TKChart. You can improve chart appearance in this scenario by disabling animations:
myChart
.allowAnimations
=
false
As I said, the issue is logged in our feedback portal and we will consider implementing partial updates for TKChart in one of our upcoming releases.
Should you have other questions, do not hesitate to ask.
Regards,
Jack
Telerik