dqask02082 2016-10-09 15:29
浏览 151
已采纳

从mysql获取数据并绘制图表

I have a temperature logger that stores a float value in mysql database, with the time and date of reading. Now I would like to use highcharts and display the values instead of in a table in a chart.

I have found an example on http://blueflame-software.com/using-highcharts-with-php-and-mysql/, but when I set my values I get this:

enter image description here

When I was getting through the code I have noticed difference in date and time format (format that I am using yyyy-mm-dd hh:mm:ss). I have changed the line

  date= Date.pars(line[0]+ ' ISO');

but no luck.

  • 写回答

2条回答 默认 最新

  • duangou2046 2016-10-09 15:59
    关注

    Convert the datetime format in your data.php.

    $t = date_create(line[0]);
    echo date_format($t, 'l, F j, Y H:i:s');
    

    This should return something like this:

    Tuesday, May 3, 2016 10:00:00
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 麒麟V10桌面版SP1如何配置bonding
  • ¥15 Marscode IDE 如何预览新建的 HTML 文件
  • ¥15 K8S部署二进制集群过程中calico一直报错
  • ¥15 java python或者任何一种编程语言复刻一个网页
  • ¥20 如何通过代码传输视频到亚马逊平台
  • ¥15 php查询mysql数据库并显示至下拉列表中
  • ¥15 freertos下使用外部中断失效
  • ¥15 输入的char字符转为int类型,不是对应的ascall码,如何才能使之转换为对应ascall码?或者使输入的char字符可以正常与其他字符比较?
  • ¥15 devserver配置完 启动服务 无法访问static上的资源
  • ¥15 解决websocket跟c#客户端通信