Vue使用Highcharts以及Echarts

Vue使用Highcharts准备工作在vue里面引用Echarts,Highcharts使用效果图Echarts使用效果图结束准备工作首先安装Echarts,Highcharts;这里我就不做讲解了,网上的教程实在是太多。如果不懂vue也没关系,我也没学过vue,容易踩坑。本篇文章Highcharts已气泡图来讲解,话不多说直接上代码在vue里面引用Echarts,Highcharts&...
摘要由CSDN通过智能技术生成

准备工作

首先安装Echarts,Highcharts;这里我就不做讲解了,网上的教程实在是太多。如果不懂vue也没关系,我也没学过vue,容易踩坑。本篇文章Highcharts已气泡图来讲解,话不多说直接上代码

在vue里面引用Echarts,Highcharts

<template>
	<!-- <div class="visit"> -->
		<div id="test" :seriesData="seriesData"></div>
	<!-- </div> -->
</template>

<script>
	import HighCharts from 'highcharts';
	import highchartsMore from 'highcharts/highcharts-more';
	highchartsMore(HighCharts);
	export default {
		data() {
			return {
				id: 'test',
				option: {
					chart: {
						type: 'packedbubble',
						height: '100%'
					},
					title: {
						text: '' //表头文字
					},
					tooltip: {
						enabled : false
					},
					legend:{
						enabled : false
					},
					credits:{
						enabled : false
					},
				
					plotOptions: {
						packedbubble: {
							minSize: '40%',
							maxSize: '120%',
							zMin: 0,
							zMax: 1000,
							layoutAlgorithm: {
								splitSeries: false,
								gravitationalConstant: 0.02
							},
							dataLabels: {
								enabled: true,
								format: '{point.name}',
								filter: {
									property: 'y',
									operator: '>',
									value: 0
								},
								style: {
									color: 'black',
									textOutline: 'none',
									fontWeight: 'normal'
								}
							}
						}
					},
					series: this.seriesData
				}
			}
		},
		props: {
			seriesData: {
				default: ''
			}
		},
		mounted() {
			// this.option.series = this.seriesData;
			console.log(this.option.series);
            HighCharts.chart(this.id, this.option);
        },
		updated(){
			HighCharts.chart(this.id, this.option);
		}
	};
</script>

template定义一个模版,方便其他需要图表的页面使用。
import highchartsMore from ‘highcharts/highcharts-more’;
highchartsMore(HighCharts);
这两行代码要有,不然可能会出现找不到highcharts的错误
:seriesData="seriesData"就是数据源了,最后HighCharts.chart(this.id, this.option);即可;updated()方法是为了数据改变是重新渲染图标

使用

<template>
	<div class="search">
		<Card>
			<Row type="flex" justify="start" class="code-row-bg">
				<div style="border-right:1px solid #ccc;width: 60%;margin-top: -1%;">
					<Col>
					<visite-pie1 :seriesData="seriesData"></visite-pie1>
					</Col>
				</div>

				<div style="width: 40%;"> 
					<Input type="text" v-model="search.keyword" clearable placeholder="请输入姓名或病历号" style="width: 300px;margin-left: 10%;margin-top: 30%;" />
					<wlink :to="{name:'case-case-list',query:{id:search}}">
						<Button style="margin-top: 30%;">搜索</Button>
					</wlink>
					<Row>
						<wlink :to="{name:'case-case-sift',query:{id:0}}">
							<Button style="margin-top: 20%;margin-left: 40%;" type="primary">高级筛选</Button>
						</wlink>
					</Row>
				</div>
			</Row>
		</Card>

	</div>
</template>

<script>
	import visitePie1 from "@/views/case/template/visitePie1";
	import util from "@/libs/util";
	export default {
		name: "count-manage",
		components: {
			visitePie1
		},
		data() {
			return {
				search:{
					keyword:''
				},
				seriesData:[],
				xData:[]
			};
		},
		methods: {
			getCoun
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值