Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     if (ctx) {
  2.  
  3. var jsonData = $.ajax({
  4.     url: 'http://hem.soderquist.nu/inc/temp_7days.php',
  5.     dataType: 'json',
  6.   }).done(function (data) {
  7.  
  8.     // Split timestamp and data into separate arrays
  9.     //console.log(data);
  10.     var data = [], label = [];
  11.  
  12.       ctx.height = 130;
  13.       var myChart = new Chart(ctx, {
  14.         type: 'line',
  15.         data: {
  16.           labels: label,
  17.           type: 'line',
  18.           datasets: [{
  19.             data: data,
  20.             label: 'Dataset',
  21.             backgroundColor: 'rgba(255,255,255,.1)',
  22.             borderColor: 'rgba(255,255,255,.55)',
  23.           },]
  24.         },
  25.         options: {
  26.           maintainAspectRatio: true,
  27.           legend: {
  28.             display: false
  29.           },
  30.           layout: {
  31.             padding: {
  32.               left: 0,
  33.               right: 0,
  34.               top: 0,
  35.               bottom: 0
  36.             }
  37.           },
  38.           responsive: true,
  39.           scales: {
  40.             xAxes: [{
  41.               gridLines: {
  42.                 color: 'transparent',
  43.                 zeroLineColor: 'transparent'
  44.               },
  45.               ticks: {
  46.                 fontSize: 2,
  47.                 fontColor: 'transparent'
  48.               }
  49.             }],
  50.             yAxes: [{
  51.               display: false,
  52.               ticks: {
  53.                 display: false,
  54.               }
  55.             }]
  56.           },
  57.           title: {
  58.             display: false,
  59.           },
  60.           elements: {
  61.             line: {
  62.               borderWidth: 0
  63.             },
  64.             point: {
  65.               radius: 0,
  66.               hitRadius: 10,
  67.               hoverRadius: 4
  68.             }
  69.           }
  70.         }
  71.       });
  72.     });
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement