Advertisement
Guest User

Untitled

a guest
May 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import PropTypes from 'prop-types';
  2. import React from 'react';
  3.  
  4. import ChartPadding from '../tools/ChartPadding';
  5.  
  6.  
  7. var chartOptions = {};
  8.  
  9. export default class HistoricDataChart extends React.Component {
  10. static propTypes = {
  11. noumenon_name: PropTypes.string.isRequired,
  12. historic_data: PropTypes.array.isRequired,
  13. };
  14.  
  15. componentDidMount() {
  16. this.plot();
  17. }
  18.  
  19. componentDidUpdate() {
  20. this.plot();
  21. }
  22.  
  23. shouldRenderAndPlot()
  24. {
  25. return(this.props.historic_data.length > 2);
  26. }
  27.  
  28. plot()
  29. {
  30. if( this.shouldRenderAndPlot() )
  31. {
  32. this.actuallyPlot();
  33. }
  34. }
  35.  
  36. ...
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement