There is a piece of hardware that records data. I can call an API to get the stream of data via cURL. It records a new row of data every seconds. I would like to stream this data and present it in a line chart over time. With PHP and maybe AJAX. I would like to see a moving chart in the browser refreshing the browser in every seconds or using Ajax. What kind of tools do I need? What is the best way of doing this?
Thank you, Everybody these are really useful things. At the moment I'm struggling to get the data from the hardware. I can reach the data via an interface which is written like this:
192.168.150.130:2345/realtime
Then I can see in the browser this:
DM_NumLogChans=5
DM_NumDataModes=1
DM_LogicalChan=1
DM_ChanType=SEQUENTIAL
DM_NumDims=2
DM_DataMode=1
DM_DataModeType=TIMHIS
DM_AxisLabel.Dim1=Time
DM_AxisLabel.Dim2=Value
DM_AxisUnits.Dim1=secs
DM_AxisUnits.Dim2=microstrain
DM_SampleRate=1.000000
DM_TimeBase=0.0
DM_ChanName=bridge_1
DM_UserMin=-583.220764
DM_UserMax=940.916199
DM_Start=
-439.779 -391.875 -680.114 1001.37 0
-442.068 -396.62 -680.945 1001.37 0
-443.571 -399.705 -680.639 1001.37 0
-445.598 -404.848 -684.662 1001.37 0
These are recorded data I can't get it from the URL. I would like to save it or live stream it somehow.
I suggest you to use Google Charts's Line plot. See this jsFiddle example of how to add data automatically. This is simple as using the data.addRow([ DATA_INDEX, VALUE_1, VALUE_2, ... ]);
This use jQuery for plot initialization and "click" event. You'll have to make a loop in order to retrieve data and add it to the plot.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With