vue中添加echarts

方法一:全局引入echarts
步骤:
1、全局安装 echarts依赖。 cnpm install echarts -- save
2、引入echarts模块,在Vue项目的main.js中引入echarts模块,即是写入如下代码:
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
3、在需要的组件,如index.vue中
<template>
<div class="echart-box" id="E_zkcl" style="width: 380px;
height:330px"></div>
</template>
<script>
export default {
data(){
return(){
}
},
methods: {
drawLine(){
let myChart1 = this.$echarts.init(document.getElementById('E_zkcl')) }
myChart1.setOption({
color:['#4ED8DA'],
title : {
text: '每月检修统计',
x:,
y:,
textStyle:{
fontSize: ,
fontWeight: 'bolder',
color: '#333'
}
},
tooltip : {
trigger: 'axis'
},
grid:{
borderWidth:,
x:'10%',
y:'20%',
x2:'5%',
y2:'15%',
},
calculable : true,
xAxis : [
{
type : 'category',
axisLine:{
show:false,
},
splitLine:{
show:false, //不显示分割线
},
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
}
],
yAxis : [
{
type : 'value',
axisLine:{
show:false,
}
}
],
series : [
{
name:'数量',
type:'bar',
data:[, , , , , , , , , , , ],
}
]
});
//根据窗口的大小变动图表 --- 重点
window.onresize = function(){
myChart.resize();
//myChart1.resize(); //若有多个图表变动,可多写
}
},
mounted(){
this.drawLine();
}
}
</script>
方法二:按需引入
vue中添加echarts的更多相关文章
- vue中添加Echarts图表的使用,Echarts的学习笔记
项目中需要使用一些折线图.柱状图.饼状图等等,之前使用过heightCharts(关于heightCharts请看我的另一篇 http://www.cnblogs.com/jasonwang2y60/ ...
- 在vue中使用echarts图表
在vue中使用echarts图表 转载请注明出处:https://www.cnblogs.com/wenjunwei/p/9815290.html 安装vue依赖 使用npm npm instal ...
- vue中使用echarts的两种方法
在vue中使用echarts有两种方法一.第一种方法1.通过npm获取echarts npm install echarts --save 2.在vue项目中引入echarts 在 main.js 中 ...
- 在vue中调用echarts中的地图散点图~
首先!当然是在vue中引入echarts! 命令行 npm install echarts --save 在main.js文件中里引入 import echarts from 'ech ...
- Vue中使用ECharts画散点图加均值线与阴影区域
[本文出自天外归云的博客园] 需求 1. Vue中使用ECharts画散点图 2. 在图中加入加均值线 3. 在图中标注出阴影区域 实现 实现这个需求,要明确两点: 1. 知道如何在vue中使用ech ...
- vue中添加util公共方法&&ES6之import、export
vue中添加util公共方法&&ES6之import.export https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Re ...
- 记录下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 ...
- VUE中集成echarts时 getAttribute of null错误
错误 错误场景一: 错误提示: 在运行Vue项目时出现了上述错误,出现该错误的原因是Echarts的图形容器还未生成就对其进行了初始化所造成的,代码如下: // 基于准备好的dom,初始化echart ...
随机推荐
- 最全PyCharm教程--for python
PyCharm简介: PyCharm是由JetBrains打造的一款Python IDE,VS2010的重构插件Resharper就是出自JetBrains之手. 同时支持Google App E ...
- Python flask虚拟环境安装
1.安装virtualenv 2.在当前路径下创建文件夹,启动虚拟环境 3.在使用虚拟环境前需激活,前面出现(env说明在虚拟环境中).虚拟环境中默认安装了pip,所以直接pip安装flask 4.在 ...
- 2019.2.25考试T1, 矩阵快速幂加速递推+单位根反演(容斥)
\(\color{#0066ff}{题解}\) 然后a,b,c通过矩阵加速即可 为什么1出现偶数次3没出现的贡献是上面画绿线的部分呢? 考虑暴力统计这部分贡献,答案为\(\begin{aligned} ...
- 河南省第十一届ACM程序设计竞赛 修路
Problem C: 修路 Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 63 Solved: 22[Submit][Status][Web Boar ...
- Qt 学习之路 2(14):对话框数据传递
Home / Qt 学习之路 2 / Qt 学习之路 2(14):对话框数据传递 Qt 学习之路 2(14):对话框数据传递 豆子 2012年9月15日 Qt 学习之路 2 53条评论 对话框 ...
- Mybatis学习笔记(六) —— 动态sql
通过mybatis提供的各种标签方法实现动态拼接sql. 需求:根据性别和名字查询用户 查询sql: SELECT id, username, birthday, sex, address FROM ...
- Django 05 自定义过滤器、自定义标签
Django 05 自定义过滤器.自定义标签 一.自定义过滤器 #1.在项目目录下创建一个python package包 取名为common(这个名字可以自定义) #2.在common目录下创建一个t ...
- logrotate 日志管理
查看logrotate 是否已安装 因为linux安装软件的方式比较多,所以没有一个通用的办法能查到某些软件是否安装了.总结起来就是这样几类: 1.rpm包安装的,可以用rpm -qa看到,如果要查找 ...
- Kibana6.x.x——启动后警告信息:Session cookies will be transmitted over insecure connections. This is not recommended.
启动Kibana后,如果你看到如下警告信息: server log [08:03:18.001] [warning][security] Session cookies will be transmi ...
- Linux中***配置
Ubuntu系统下: 1.执行如下命令 sudo apt install shadowsocks polipo 2.创建 shadowsocks.json 配置文件,放在你想放的位置 { " ...