vue画图运用echarts
<template>
<div class="tubiao">
<div id="main" style="width: 600px;height:400px;"></div>
</div>
</template> <script>
import echarts from 'echarts';
export default {
name: 'tubiao',
data () {
return {
chart: null
}
},
methods:{
drawPie (id) {
this.chart = echarts.init(document.getElementById('main'));
this.chart.setOption({
title: {
text: 'ECharts 入门示例'
},
tooltip: {},
legend: {
data:['销量']
},
xAxis: {
data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
}]
})
}
},
mounted(){
this.$nextTick(function() {
this.drawPie('main');
var that = this;
var resizeTimer = null;
window.onresize = function() {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
that.drawPie('main');
}, 100);
}
});
}
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> </style>

先进行安装echarts,
然后在根据echarts官网的提示例子,进行开发练手,
最后就是配置一下路由,进行页面的跳转。
更多更好的效果,可以再echarts官网查看。
vue画图运用echarts的更多相关文章
- Vue中使用ECharts画散点图加均值线与阴影区域
[本文出自天外归云的博客园] 需求 1. Vue中使用ECharts画散点图 2. 在图中加入加均值线 3. 在图中标注出阴影区域 实现 实现这个需求,要明确两点: 1. 知道如何在vue中使用ech ...
- 在vue中使用echarts图表
在vue中使用echarts图表 转载请注明出处:https://www.cnblogs.com/wenjunwei/p/9815290.html 安装vue依赖 使用npm npm instal ...
- 在vue中调用echarts中的地图散点图~
首先!当然是在vue中引入echarts! 命令行 npm install echarts --save 在main.js文件中里引入 import echarts from 'ech ...
- vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined
vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined 借鉴了该大神的文 ...
- vue 下实现 echarts 全国到省份的地图下钻
vue 下实现 echarts 全国到省份的地图下钻 项目地址:https://github.com/cag2050/vue_echarts_v3_demo
- vue+vuex+axios+echarts画一个动态更新的中国地图
一. 生成项目及安装插件 # 安装vue-cli npm install vue-cli -g # 初始化项目 vue init webpack china-map # 切到目录下 cd china- ...
- vue组件之echarts报表
vue组件之echarts报表 将echarts报表封装成组件,动态传入数据,显示图表. 1.饼状图 父组件: <MPie :datas="piedata"></ ...
- 记录下vue 中引用echarts 出现 "TypeError: Cannot read property 'getAttribute' of undefined"问题
今天做项目,用echarts展示数据 ,自己测试 先测试 了下.写的代码html: <div ref="myChart" style="height:300px;w ...
- vue中使用echarts(vue+vue-cli+axios+jsonp+echarts)
一.安装echarts: cnpm i echarts -D 二.在vue-cli的main.js文件中引用echarts: import charts from 'echarts' Vue.prot ...
随机推荐
- 《浏览器工作原理与实践》<01>Chrome架构:仅仅打开了1个页面,为什么有4个进程?
无论你是想要设计高性能 Web 应用,还是要优化现有的 Web 应用,你都需要了解浏览器中的网络流程.页面渲染过程,JavaScript 执行流程,以及 Web 安全理论,而这些功能是分散在浏览器的各 ...
- IPC之syscall.c源码解读
// SPDX-License-Identifier: GPL-2.0 /* * sys_ipc() is the old de-multiplexer for the SysV IPC calls. ...
- kubernetes之requests和limits
说明 1.当集群中的计算资源不很充足, 如果集群中的pod负载突然加大, 就会使某个node的资源严重不足, 为了避免系统挂掉, 该node会选择清理某些pod来释放资源, 此时每个pod都可能成为牺 ...
- 4.4. Item Pipeline管道文件
0:Spider爬取数据 # -*- coding: utf-8 -*- import scrapy import sys from mySpider.items import ItcastItem ...
- less 分页显示文件内容
1.命令功能 less 是more的增强版,可以分页显示文件内容,而且less打开文件的速度要比vi,more更快.less支持搜索功能,显示行号. 2.语法格式 less option file ...
- Psychos in a Line CodeForces - 319B (单调栈的应用)
Psychos in a Line CodeForces - 319B There are n psychos standing in a line. Each psycho is assigned ...
- grub命令行和配置文件配置配置信息
一.grub简介 GNU GRUB(简称“GRUB”)是一个来自GNU项目的启动引导程序.GRUB是多启动规范的实现,它允许用户可以在计算机内同时拥有多个操作系统,并在计算机启动时选择希望运行的操作系 ...
- 记录weblogic12c通用版本在windowsXP上安装报异常的问题:java.lang.NoClassDefFoundError:
先上图: 这个可能有经验的人一眼就看出问题了,报这个错的原因是:我把安装包放在了中文目录下,本来以为安装包放在中文目录下无关紧要,但是weblogic12c就是这么神奇,不能放在中文目录下. 解决方法 ...
- 【每日一包0015】gradient-string
[github地址:https://github.com/ABCDdouyae...] gradient-string 用于在终端打印出好看的渐变文字 普通用法 console.log(gradien ...
- c语言结构体以及结构体指针的使用
结构体: 正常定义一个结构体: typedef struct node{ ]; int len; }Seq,*llink; 定义结构体指针: Seq *s;或者llink t;之后关于s与t的用法,其 ...