日常记录:echarts-liquidfill使用
来源:互联网 发布:商城购物车数据库设计 编辑:程序博客网 时间:2024/05/29 10:22
第一步:echarts与echarts-liquidfill添加到项目
- 添加echarts
npm install echarts --save
- 添加echarts-liquidfill组件
npm install echarts-liquidfill
第二步:引用
import echarts from 'echarts'import liquidfill from 'echarts-liquidfill'
第三步:html,css
<div id="liquidfill-chart"></div>
<style scoped> #liquidfill-chart { width: 100%; height: 140px; margin-bottom: 10px; }</style>
第四步:初始化模版(为了方便多个页面共同使用)
- 引入方法
import { initOption as ioption } from 'liquidfillOptions.js'
export default{ data() { return { opt: ioption } }}
- liquidfillOptions.js文件—-这里放水球图的通用设置。
export let initOption = { series:[{ type: 'liquidFill', data: [0.5, 0.4, 0.3, 0.2], outline: { show: false }, shape: 'container', label: { normal: { formatter: function () { return '这里是我要在js中获取的数据'; }, textStyle: { color: '#D94854' } } } }]}
第五步:js获取
mounted() { var _this = this; _this.$http.get('api地址').then((res) => { res = JSON.parse(res); let _chart = echarts.init(document.getElementById("liquidfill-chart")); /*获取*/ _this.opt.series[0].label.normal.formatter = function () { return res.yDatas[0] + '元'; } _chart.setOption(_this.opt); }); }
阅读全文
0 0
- 日常记录:echarts-liquidfill使用
- echarts liquidFill
- aapt日常日常使用记录
- ECHARTS 使用记录
- linux 日常使用记录
- Git日常使用记录
- 日常zookeeper的使用记录(一)
- Android菜鸟笔记-Fragment日常使用记录
- velocity模板使用(日常记录)
- Mysql日常使用记录 2017-11-23
- CSDN Markdown的日常使用记录
- 日常记录
- 日常记录
- 日常记录
- 日常记录
- 日常记录
- 日常记录
- 日常记录
- JavaScript-焦点事件
- Vue 之Element ui 中upload的那些事
- Hive学习笔记 --- Hive分区表的操作
- 输入一个表示整数的字符串,把该字符串转换成整数并输出。
- 浅谈Django中的Signal
- 日常记录:echarts-liquidfill使用
- java面向对象基础题
- 二维码生成代码
- ros中的hector_mapping节点详细介绍
- HTTP2.0与HTTP1.0的区别
- APP登录界面(网页仿制版)
- 类图的关系
- Unity3D 学习案例四
- 10 分钟理解 BFC 原理