Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. [
  2. {y: 0.74, x: 1558531380957},
  3. {y: 0.96, x: 1558531379950},
  4. {y: 1.08, x: 1558531378942},
  5. {y: 1.11, x: 1558531377939},
  6. {y: 1.13, x: 1558531376932},
  7. {y: 1.1, x: 1558531375930},
  8. {y: 0.59, x: 1558531374914},
  9. {y: 0.75, x: 1558531373911},
  10. {y: 1.25, x: 1558531372902},
  11. {y: 0.75, x: 1558531371898},
  12. {y: 0.85, x: 1558531370893},
  13. {y: 0.59, x: 1558531369889},
  14. {y: 0.4, x: 1558531368887},
  15. {y: 1.08, x: 1558531367879},
  16. {y: 1.31, x: 1558531366871},
  17. {y: 0.63, x: 1558531365866},
  18. {y: 1.19, x: 1558531364859},
  19. {y: 1.26, x: 1558531363854},
  20. {y: 0.92, x: 1558531362848},
  21. {y: 1.31, x: 1558531361837},
  22. ]
  23.  
  24. $(document).ready(function() {
  25.  
  26. var chartColors = {
  27. red: 'rgb(255, 99, 132)',
  28. blue: 'rgb(54, 162, 235)'
  29. };
  30.  
  31. var color = Chart.helpers.color;
  32.  
  33. var config = {
  34. type: 'line',
  35. data: {
  36. datasets: [{
  37. label: 'Z-Score',
  38. backgroundColor: color(chartColors.blue).alpha(0.75).rgbString(),
  39. borderColor: chartColors.red,
  40. fill: false,
  41. lineTension: 0,
  42. data: []
  43. }]
  44. },
  45. options: {
  46. responsive: true,
  47. maintainAspectRatio: false,
  48. title: {
  49. display: false,
  50. },
  51. scales: {
  52. xAxes: [{
  53. type: 'realtime',
  54. realtime: {
  55. duration: 60000,
  56. refresh: 1000,
  57. delay: 2000,
  58. pause: false,
  59. ttl: undefined,
  60. frameRate: 48,
  61.  
  62. onRefresh: function(chart) {
  63.  
  64. var data = []
  65.  
  66. $.get( "{% url 'live_z_score' %}", function(zScoreJSON) {
  67. data = zScoreJSON Array.prototype.push.apply(chart.data.datasets[0].data, data);
  68. });
  69. }
  70. }
  71. }],
  72. yAxes: [{
  73. scaleLabel: {
  74. display: true,
  75. labelString: 'value'
  76. }
  77. }]
  78. },
  79. tooltips: {
  80. mode: 'nearest',
  81. intersect: false
  82. },
  83. hover: {
  84. mode: 'nearest',
  85. intersect: false
  86. }
  87. }
  88. };
  89.  
  90. var ctx = document.getElementById('myChart').getContext('2d');
  91. window.myChart = new Chart(ctx, config);
  92.  
  93. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement