1- import React , { PureComponent } from 'react' ;
1+ import React , { Component } from 'react' ;
22
33import { MiniArea } from '../Charts' ;
44import NumberInfo from '../NumberInfo' ;
@@ -14,16 +14,16 @@ function getActiveData() {
1414 for ( let i = 0 ; i < 24 ; i += 1 ) {
1515 activeData . push ( {
1616 x : `${ fixedZero ( i ) } :00` ,
17- y : ( i * 50 ) + ( Math . floor ( Math . random ( ) * 200 ) ) ,
17+ y : Math . floor ( Math . random ( ) * 200 ) + ( i * 50 ) ,
1818 } ) ;
1919 }
2020 return activeData ;
2121}
2222
23- export default class ActiveChart extends PureComponent {
23+ export default class ActiveChart extends Component {
2424 state = {
2525 activeData : getActiveData ( ) ,
26- }
26+ } ;
2727
2828 componentDidMount ( ) {
2929 this . timer = setInterval ( ( ) => {
@@ -42,43 +42,40 @@ export default class ActiveChart extends PureComponent {
4242
4343 return (
4444 < div className = { styles . activeChart } >
45- < NumberInfo
46- subTitle = "目标评估"
47- total = "有望达到预期"
48- />
45+ < NumberInfo subTitle = "目标评估" total = "有望达到预期" />
4946 < div style = { { marginTop : 32 } } >
5047 < MiniArea
5148 animate = { false }
5249 line
5350 borderWidth = { 2 }
5451 height = { 84 }
52+ scale = { {
53+ y : {
54+ tickCount : 3 ,
55+ } ,
56+ } }
5557 yAxis = { {
56- tickCount : 3 ,
5758 tickLine : false ,
58- labels : false ,
59+ label : false ,
5960 title : false ,
6061 line : false ,
6162 } }
6263 data = { activeData }
6364 />
6465 </ div >
65- {
66- activeData && (
67- < div className = { styles . activeChartGrid } >
68- < p > { [ ...activeData ] . sort ( ) [ activeData . length - 1 ] . y + 200 } 亿元</ p >
69- < p > { [ ...activeData ] . sort ( ) [ Math . floor ( activeData . length / 2 ) ] . y } 亿元</ p >
70- </ div >
71- )
72- }
73- {
74- activeData && (
75- < div className = { styles . activeChartLegend } >
76- < span > 00:00</ span >
77- < span > { activeData [ Math . floor ( activeData . length / 2 ) ] . x } </ span >
78- < span > { activeData [ activeData . length - 1 ] . x } </ span >
79- </ div >
80- )
81- }
66+ { activeData && (
67+ < div className = { styles . activeChartGrid } >
68+ < p > { [ ...activeData ] . sort ( ) [ activeData . length - 1 ] . y + 200 } 亿元</ p >
69+ < p > { [ ...activeData ] . sort ( ) [ Math . floor ( activeData . length / 2 ) ] . y } 亿元</ p >
70+ </ div >
71+ ) }
72+ { activeData && (
73+ < div className = { styles . activeChartLegend } >
74+ < span > 00:00</ span >
75+ < span > { activeData [ Math . floor ( activeData . length / 2 ) ] . x } </ span >
76+ < span > { activeData [ activeData . length - 1 ] . x } </ span >
77+ </ div >
78+ ) }
8279 </ div >
8380 ) ;
8481 }
0 commit comments