Advertisement
Guest User

the component

a guest
Jan 19th, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. class HighGraph extends Component {
  2. state = {
  3. title: {
  4. text: "My chart"
  5. },
  6. series: [
  7. {
  8. data: [1, 2, 3]
  9. }
  10. ]
  11. };
  12.  
  13. componentDidMount() {
  14. let _this = this;
  15.  
  16. _this.interval = setInterval(function() {
  17. console.log(_this.state.series[0].data);
  18. _this.state.series[0].data = _this.props.list;
  19. }, 2000);
  20. }
  21.  
  22. componentWillUnmount() {
  23. clearInterval(this.interval);
  24. }
  25.  
  26. render() {
  27. return (
  28. <div>
  29. <HighchartsReact highcharts={Highcharts} options={this.state} />
  30. </div>
  31. );
  32. }
  33. }
  34.  
  35. export default HighGraph;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement