diff --git a/package.json b/package.json index 4b7f7f15f1a6eaef084ddca81a5bbe1aeb58497a..ceef972cfd8bc30d1bcc239eb2347ecf411b5677 100755 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "eslint-plugin-babel": "^4.0.0", "eslint-plugin-import": "^2.2.0", "eslint-plugin-jsx-a11y": "^5.0.1", + "eslint-plugin-markdown": "^1.0.0-beta.6", "eslint-plugin-react": "^7.0.1", "gh-pages": "^1.0.0", "husky": "^0.13.4", diff --git a/src/components/ActiveChart/index.js b/src/components/ActiveChart/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1ab1cd54cb8b9de2a79aadda68686cb05e245dd0 --- /dev/null +++ b/src/components/ActiveChart/index.js @@ -0,0 +1,77 @@ +import React, { PureComponent } from 'react'; + +import { NumberInfo, MiniArea } from '../Charts'; +import { fixedZero } from '../../utils/utils'; + +import styles from './index.less'; + +function getActiveData() { + const activeData = []; + for (let i = 0; i < 24; i += 1) { + activeData.push({ + x: `${fixedZero(i)}:00`, + y: (i * 50) + (Math.floor(Math.random() * 200)), + }); + } + return activeData; +} + +export default class ActiveChart extends PureComponent { + state = { + activeData: getActiveData(), + } + + componentDidMount() { + setInterval(() => { + this.setState({ + activeData: getActiveData(), + }); + }, 1000); + } + + render() { + const { activeData = [] } = this.state; + + return ( +
{[...activeData].sort()[activeData.length - 1].y + 200} 亿元
+{[...activeData].sort()[Math.floor(activeData.length / 2)].y} 亿元
+{[...activeData].sort()[activeData.length - 1].y + 200} 亿元
-{[...activeData].sort()[Math.floor(activeData.length / 2)].y} 亿元
-- {item.description} -
- )} - /> -+ {item.description} +
+ )} + /> +