react 中echarts-for-react使用 自适应div

摘要:
import*asReactfrom'react'importReactEchartsfrom'charts-for-ract'导出接口IProps{}接口IState{}classCapitalBudgetsextendsReact.Component<IProps,IState>{constructor(props:IProps){super(props)
import * as React from 'react'
import ReactEcharts from 'echarts-for-react'

export interface IProps {

}
interface IState {
   
}

class CapitalBudget extends React.Component<IProps, IState> {
  
    constructor(props: IProps) {
        super(props)
       
    }

    getOption () {
        return {
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: {
                type: 'category',
                axisLabel: {
                    formatter: '{value} 年'
                },
                axisTick: {
                    alignWithLabel: true
                },
                data: ['2012', '2013', '2014', '2015', '2016', '2017', '2018']
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    formatter: '{value} 万'
                },
            },
            series: [{
                data: [820, 932, 901, 934, 1290, 1330, 1320],
                type: 'line'
            }]
        }
    }
    render() {
    
        return (
           
            <React.Fragment>  
                <ReactEcharts
                    option={this.getOption()}
                    
                    style={{ '100%', height: '238px'}}
                />
            </React.Fragment> 
        )
    }
}

export default CapitalBudget

免责声明:文章转载自《react 中echarts-for-react使用 自适应div》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇VMP加壳(二):VMP的虚拟化原理ubuntu用命令连接无线网络下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

react项目中引用amap

在调用amap的Geocoder Api 时,一直不能从AMap对象下找到Geocoder 。 结果在网上看到一个博客说的是,在index中引入链接时,需要在链接上配置plugin=AMap.Geocoder, 才能够在AMap调用Geocoder Api <script type="text/javascript" src="https://web...

react基础---react全家桶03

目录: 1. redux   1.1 原始,原始步骤   1.2 react-reducer,两种写法(导出普通写法 和 装饰器的写法)   1.3 存储多个reducer 2. redux中间键,redux-logger | redux-thunk   异步请求,调用dispatch 3. router   基本:BrowserRouter, Link,...

react.js antd-table 可编辑表格验证

最近做需求,需要在一个表格里编辑字段,验证提交.项目用的是antd的组件,看了下table组件,官网有给编辑的例子,好咧,拿过来用了下,发现问题.官网的实现写得很复杂,而且最主要的一点是只能在输入框获取焦点时调验证规则.但是在表格外面不能调用验证方法调用.与实际需求不符合,于是自己写了一个,记录下来. 需求:表格输入时验证字段,提交时点击验证字段 主要...

如何让一个DIV固定在另一个DIV的底部

<html><head><title>Test</title></head><body><div style="border:1px solid red; 500px; position:relative; height:500px;">1111111 <div st...

10 个打造 React.js App 的最佳 UI 框架

  10 个打造 React.js App 的最佳 UI 框架 在本文中,我们将分享一些助你打造 React.js App 最佳的 UI 框架。它们具备你所需要的基本 React 组件,以及易用的 API,同时,在外观和体验上也非常棒。Have Fun ! 1. Material-UI 基于谷歌 Material Design 设计规范的 Re...

JSX设置CSS样式详解

JSX设置CSS样式详解 1. 使用className设置样式(CSS的其他选择器也是同理) (1)定义一个CSS文件style.css,和普通CSS一样定义class选择器 .sty1{//和普通CSS一样定义class选择器 background-color: red; color: white; font-size: 40px...