您当前的位置: 首页 >  cmmboy1990

vue2 使用AntV 以g2plot为例

cmmboy1990 发布时间:2022-04-25 10:13:39 ,浏览量:4

1.效果 在这里插入图片描述2.代码 nmp 导入:

npm install @antv/g2plot

代码:


	
		
	



	import {
		Bar
	} from '@antv/g2plot';
	export default {
		name: 'App',
		data() {
			return {
				sj: [{
						year: '1951 年',
						value: 38
					},
					{
						year: '1952 年',
						value: 52
					},
					{
						year: '1956 年',
						value: 61
					},
					{
						year: '1957 年',
						value: 145
					},
					{
						year: '1958 年',
						value: 48
					},
					
				]
			}
		},

		mounted() {
			const bar = new Bar('container', {
				data: this.sj,
				xField: 'value',
				yField: 'year',
				seriesField: 'year',
				legend: {
					position: 'top-left',
				},
			});

			bar.render();
		}
	}






关注
打赏
1688896170
查看更多评论

cmmboy1990

暂无认证

  • 4浏览

    0关注

    131博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0709s