Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <script>
  2. var arrayGegevens = <?php echo json_encode($arrayLineChart1); ?>;
  3. //de data voor in de grafiek
  4.  
  5. var data =
  6. {
  7. labels: [],
  8. datasets: [
  9. {
  10. label: "Machine activity",
  11. fillColor: "rgba(151,187,205,0.2)",
  12. strokeColor: "rgba(151,187,205,1)",
  13. pointColor: "rgba(151,187,205,1)",
  14. pointStrokeColor: "#fff",
  15. pointHighlightFill: "#fff",
  16. pointHighlightStroke: "rgba(151,187,205,1)",
  17. data: []
  18. }]
  19. };
  20.  
  21. //ctx = plek waar de grafiek wordt geplaatst(canvasLineChart)
  22. var ctx = document.getElementById("canvasLineChart").getContext("2d");
  23.  
  24. //De grafiek aanmaken en alles koppelen(plaats van grafiek + data koppelen)
  25. var myLineChart = new Chart(ctx).Line(data,
  26. {
  27. bezierCurve: false,
  28. animation: false,
  29. pointDot : false,
  30. pointHitDetectionRadius : -1,
  31. showTooltips: false,
  32. scaleOverride: true,
  33. scaleSteps: 1,
  34. scaleStepWidth: 1,
  35. scaleStartValue: 0
  36. });
  37.  
  38. for(i = 0; i < arrayGegevens.length; i++)
  39. {
  40. var TimeShort= arrayGegevens[i]['Time'].substr(11,5);
  41.  
  42. if (TimeShort.substr(4,1) == '5') //alle waardes die eindigen op 5 (bijv: 14:05) worden niet gedisplayed op de grafiek
  43. {
  44. myLineChart.addData([arrayGegevens[i]['MachineStatus']], '');
  45. }
  46. else
  47. {
  48. myLineChart.addData([arrayGegevens[i]['MachineStatus']], TimeShort); // punt toevoegen
  49. }
  50. }
  51. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement