通过php从mysql中检索数据,创建flot图

前端之家收集整理的这篇文章主要介绍了通过php从mysql中检索数据,创建flot图前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
嗨,我正在尝试从 mysql数据库检索数据以创建虚拟图
任何人都可以通过这个程序走走,或者给我一个想法
谢谢
你可能想要这样的东西.我没有用过,但是我看了这个例子 here.
  1. <?PHP
  2. //create array of pairs of x and y values
  3. $dataset1 = array();
  4. while ($row = MysqL_fetch_assoc()) { //or whatever
  5. $dataset1[] = array( $row['xvalue'],$row['yvalue'] );
  6. }
  7. ?>
  8.  
  9. <script type="text/javascript">
  10. //put array into javascript variable
  11. var dataset1 = <?PHP echo json_encode($dataset1); ?>;
  12.  
  13. //plot
  14. $(function () {
  15. $.plot($("#placeholder"),[ dataset1 ]);
  16. });
  17. </script>

猜你在找的PHP相关文章