esnet / react-timeseries-charts

Declarative and modular timeseries charting components for React
http://software.es.net/react-timeseries-charts
Other
861 stars 284 forks source link

Realtime data plotting, is this normal behavior? #392

Closed hp8wvvvgnj6asjm7 closed 5 years ago

hp8wvvvgnj6asjm7 commented 5 years ago

sin

    this.state = {
      data : {
          "name": "x",
          "columns": ["time", "value"],
          "points": []
        }
    };

componentDidMount() {
  let i = 0;
  setInterval(()=>{
    this.state.data.points.push( [new Date(), Math.round(Math.sin(i/10)*50+50)] );
    this.state.data.points.shift();
    this.setState({ data : this.state.data });
    i++;
  }, 100);
hp8wvvvgnj6asjm7 commented 5 years ago

Sorry, this was because of the new Date function =)