Guest User

Untitled

a guest
Feb 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. var dayByDayChart = new Chart(ctx, {
  2. type: 'line',
  3. data: {
  4. labels: <?php echo json_encode($arr_dates); ?>,
  5. //labels: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],
  6. datasets: [{
  7. label: '<?php echo $thisYear; ?>',
  8. data: [<?php echo $rev2017; ?>],
  9. backgroundColor: "rgba(153,255,51,0.6)"
  10. }, {
  11. label: '<?php echo $lastYear;?>',
  12. data: [<?php echo $rev2016; ?>],
  13. backgroundColor: "rgba(255,153,0,0.6)"
  14. }]
  15. },
  16. options: {
  17. responsive: true,
  18. maintainAspectRatio: false,
  19. scales: {
  20. xAxes: [{
  21. type: 'time',
  22. time: {
  23. displayFormats: {
  24. 'millisecond': 'MMM DD',
  25. 'second': 'MMM DD',
  26. 'minute': 'MMM DD',
  27. 'hour': 'MMM DD',
  28. 'day': 'MMM DD',
  29. 'week': 'MMM DD',
  30. 'month': 'MMM DD',
  31. 'quarter': 'MMM DD',
  32. 'year': 'MMM DD'
  33. }
  34. }
  35. }]
  36. }
  37. }
  38.  
  39. });
  40.  
  41. dayByDayChart.data.datasets[0].data = json.this_year;
  42. dayByDayChart.data.datasets[1].data = json.last_year;
  43. dayByDayChart.data.labels = json.dates;
Add Comment
Please, Sign In to add comment