vue项目中使用echarts
来源:互联网 发布:s7总决赛现场数据 编辑:程序博客网 时间:2024/06/05 08:08
vue-cli创建的项目中
1.安装echarts依赖
cnpm install echarts -S
2.在需要创建图表的页面中按需引入
<div class="chart" ref="chartOne" :style="{width: '300px', height: '300px'}"></div><script type="text/ecmascript-6"> //引入Echarts主模块 let echarts=require('echarts/lib/echarts'); //引入柱状图 require('echarts/lib/chart/bar'); //引入圆饼图 require('echarts/lib/chart/pie'); //引入所需组件 require('echarts/lib/component/tooltip'); require('echarts/lib/component/legend'); export default { data () { return {} }, methods:{ /*创建图表一*/ createChartOne(){ let chartOne=echarts.init(this.$refs.chartOne); chartOne.setOption({ title: { text: '在Vue中使用echarts' }, tooltip: {}, xAxis: { data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] }, yAxis: {}, series: [{ name: '销量', type: 'bar', data: [5, 20, 36, 10, 10, 20] }] }) } }, mounted(){ this.createChartOne(); }, }</script>
这里之所以使用 require 而不是 import,是因为 require 可以直接从 node_modules 中查找,而 import 必须把路径写全。
阅读全文
1 0
- vue项目中使用echarts
- 在Vue-cli项目中使用echarts
- vue项目中使用echarts图表
- 在Vue项目中使用Echarts(五): Echarts绘制地图
- Vue系列——在vue项目中使用echarts
- Vue系列——在vue项目中使用echarts
- Vue.js中,使用echarts
- vue 中 echarts 的简单使用
- 在Vue项目中如何使用其他插件(eCharts & wangeditor)
- Android项目中使用echarts
- vue使用echarts
- ionic2 项目中使用echarts图表,Jquery
- vue项目中使用jQuery
- vue项目中使用ueditor
- vue项目中使用sass
- vue 中使用vue-echarts-v3编写chart柱状图,动态展示数据
- 项目中应用Echarts
- echarts 项目使用总结
- Tomcat集群配置学习篇(MARK)
- javaweb基础之--Servlet
- EasyNVR H5无插件摄像机直播解决方案前端解析之:videojs初始化的一些样式处理
- C# ADO.NET动态数据的增删改查(第五天)
- android——studio中去除标题栏
- vue项目中使用echarts
- Retrofit源码分析 (五. Retrofit 深入分析)
- redis 连接报错
- 基于ARM的模拟器
- Spring在代码中获取bean的几种方式
- 联币网,联盟华中区共建区块链大生态系统
- 超直白win7性能优化方案
- 数据库day01(1)
- 3种LVS/Nginx/HAProxy负载均衡器的对比分析(MARK)