Advertisement
Guest User

main.js

a guest
Mar 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3. $.ajax({
  4. url: "./getdatas.php",
  5. context: document.body
  6.  
  7. }).done(function(retour) {
  8.  
  9. retour = $.parseJSON(retour);
  10.  
  11. var values = [];
  12. var datestimes = [];
  13.  
  14. retour.forEach(function (val) {
  15. values.push (val.temp);
  16. datestimes.push(val.datatime);
  17. });
  18.  
  19. //$ appel jquery #jqchart id dans l'html .jqchart() : bibliothèque
  20. $('#jqChart').jqChart({
  21. title: { text: 'Spline Chart' },
  22. tooltips: { type: 'shared' },
  23. animation: { duration: 1 },
  24. axes: [
  25. {
  26. type: 'category',
  27. location: 'bottom',
  28. categories: datestimes
  29.  
  30. }
  31. ],
  32. series: [
  33. {
  34. type: 'spline',
  35. title: 'Valeurs',
  36. data: values,
  37. strokeDashArray: [0,3]
  38. },
  39.  
  40. ]
  41. });
  42.  
  43.  
  44. });
  45.  
  46.  
  47. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement