duanqin9507 2013-09-30 12:16
浏览 169

如何使用PHP,cURL,ajax流式传输实时数据并将其显示在折线图中

There is a hardware that records a 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 struggeling to get the data from the hardware. I can reach the data via an interface wich 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 cant get it from the url. I would like to save it or live stream it somehow. Sorry about the poor english.

  • 写回答

2条回答 默认 最新

  • dtf1111 2013-09-30 12:36
    关注

    Any of the various JS chart libraries out there should be able to present a line chart for you via loading data up through ajax calls. Here are a few:

    http://www.fusioncharts.com

    http://www.chartjs.org

    http://www.jscharts.com

    http://www.amcharts.com

    ... and there are plenty more. Just find one that works best for you.

    To run the ajax call that refreshes the charts every x-seconds, use something like this:

    Call jQuery Ajax Request Each X Minutes

    Also, take a look at this answer on the amCharts forum: http://www.amcharts.com/forum/viewtopic.php?id=12625

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog