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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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={{width: '100%', height: '238px'}}
                />
            </React.Fragment>
        )
    }
}
 
export default CapitalBudget

  

posted @   Webwhl  阅读(2120)  评论(1编辑  收藏  举报
编辑推荐:
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 提示词工程——AI应用必不可少的技术
· 地球OL攻略 —— 某应届生求职总结
· 字符编码:从基础到乱码解决
· SpringCloud带你走进微服务的世界
点击右上角即可分享
微信分享提示