Advertisement
saimado

Untitled

Aug 31st, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. createLineChart: function (id, history, min, max) {
  2.             var ctx = document.querySelector('#' + id).getContext("2d");
  3.             for (var i = 0; i < history.length; i++) {
  4.                 history[i] = Math.round(history[i] * 100) / 100;
  5.             }
  6.             var lineChartData = {
  7.                 labels: ['', '', '', '', ''],
  8.                 datasets: [
  9.                     {
  10.                         label: id,
  11.                         fillColor: "rgba(56,142,60,0.4)",
  12.                         strokeColor: "rgba(56,142,60,1)",
  13.                         pointColor: "rgba(56,142,60,1)",
  14.                         pointStrokeColor: "#fff",
  15.                         pointHighlightFill: "#fff",
  16.                         pointHighlightStroke: "rgba(56,142,60,1)",
  17.                         data: history
  18.                     },
  19.                     {
  20.                         //an empty dataset to trigger custom tooltips
  21.                     }
  22.                 ]
  23.             };
  24.             var c = new Chart(ctx).Line(lineChartData, {
  25.                 responsive: true
  26.             });
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement