echartsView.jsx 692 B

12345678910111213141516171819202122232425
  1. import React from 'react'
  2. import Echarts from 'echarts-for-react'
  3. import { connect } from 'dva'
  4. import { hashcode } from '../../../utils/baseUtils'
  5. import EmptyContent from '../../common/emptyContent'
  6. const EchartsView = ({ chartDesigner }) => {
  7. const { chartOption } = chartDesigner;
  8. if(!chartOption.series) {
  9. return <EmptyContent />
  10. }else {
  11. return <Echarts
  12. key={hashcode(chartOption)}
  13. option={chartOption}
  14. className='rc-echarts'
  15. style={{height: '100%'}}
  16. />
  17. }
  18. }
  19. function mapStateToProps({ present: { chartDesigner } }) {
  20. return { chartDesigner: chartDesigner }
  21. }
  22. export default connect(mapStateToProps)(EchartsView);