Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created May 2, 2019 15:41
Show Gist options
  • Save gpDA/61358a2c0a530e41f654648cf9bfc605 to your computer and use it in GitHub Desktop.
Save gpDA/61358a2c0a530e41f654648cf9bfc605 to your computer and use it in GitHub Desktop.
// ./components/Chart/Chart.js
constructor() {
super();
// initialize array with default value (1,2,3) respectively
let inital_line_1 = new Array(31).fill(1);
let inital_line_2 = new Array(31).fill(2);
let inital_line_3 = new Array(31).fill(3);
this.state = {
inital_line_1: inital_line_1,
inital_line_2: inital_line_2,
inital_line_3: inital_line_3,
counter: 0,
}
//update the function for 30 seconds
// TODO: MY BAD 30 --> 10
setInterval(this.updateArray.bind(this), 10 * 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment