SHARE
TWEET

Untitled

a guest Sep 17th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onRefresh(chart) {
  2.     $.ajax({
  3.         url: 'api/measurement/?format=json',
  4.         data: {
  5.             'datetime': Date.now()
  6.         },
  7.         dataType: 'json',
  8.         success: function(data){
  9.             data.forEach(function(d) {
  10.                 chart.config.data.datasets.forEach(function(dataset) {
  11.                     dataset.data.push({
  12.                         x: Date.parse(d.datetime),
  13.                         y: d.i_max
  14.                     });
  15.                 })
  16.             })
  17.    
  18.         }
  19.     })
  20. }
  21. var color = Chart.helpers.color;
  22. var config = {
  23.     type: 'line',
  24.     data: {
  25.         datasets: [{
  26.             label: 'Streaming Impedance chart',
  27.             backgroundColor: color(chartColors.red).alpha(0.5).rgbString(),
  28.             borderColor: chartColors.red,
  29.             fill: false,
  30.             lineTension: 0,
  31.             borderDash: [8, 4],
  32.             data: []
  33.         },
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top