vue 第五节
来源:互联网 发布:vb.net winhttp 编辑:程序博客网 时间:2024/06/06 11:40
集成echars
BI类的信息一般都会用到图片统计表格,以前用过highcharts,不过听说百度的echars很不错支持的类型更多,api更友好。
首先安装依赖
cnpm install –save echarts -D
新建一个view echar.vue
具体数据参考文档
<template> <div> <el-col :span="12"> <div id="map" style="width:100%; height:400px;"></div> </el-col> <el-col :span="12"> <div id="chartPie" style="width:100%; height:400px;"></div> </el-col> </div></template><script>import echarts from 'echarts'import chinaJson from '../../static/data/china.json'export default { name: 'echar', data () { return { map: null, pie: null } }, mounted: function () { let _this = this echarts.registerMap('china', chinaJson) _this.map = echarts.init(document.getElementById('map')) _this.pie = echarts.init(document.getElementById('chartPie')) _this.map.setOption({ title: { text: '中国地图', subtext: '测试下', x: 'center' }, tooltip: { trigger: 'item', formatter: '{b}' }, series: [ { name: '中国', type: 'map', mapType: 'china', selectedMode: 'multiple', label: { normal: { show: true }, emphasis: { show: true } }, data: [ {name: '湖南', selected: true} ] } ] }) this.pie.setOption({ title: { text: '程序猿', subtext: '我乱搞的', x: 'center' }, tooltip: { trigger: 'item', formatter: '{a} <br/>{b} : {c} ({d}%)' }, legend: { orient: 'vertical', left: 'left', data: ['死宅', '二次元', '游戏控', '爱妹纸', '爱美剧'] }, series: [ { name: '程序员', type: 'pie', radius: '55%', center: ['50%', '60%'], data: [ {value: 835, name: '游戏控'}, {value: 410, name: '爱美剧'}, {value: 274, name: '死宅'}, {value: 135, name: '爱妹纸'}, {value: 1048, name: '二次元'} ], itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] }) }}</script>
这里要去下载地图地图
测试下
0 0
- vue 第五节
- 第五节 实现接口
- 第五节 电能质量
- 第一章 --- 第五节
- 第二章 --- 第五节
- 第三章 --- 第五节
- 第五节 定时器使用
- php学习 第五节
- java笔记第五节
- 第五节,const作用
- 【第二章 第五节】
- 第五节 Dialog
- 第五节 字符处理
- 函数第五节
- 第五节 多态性
- 第五节 GDB常用命令
- 第五节GDB使用
- 编译原理:第五节
- MPI Maelstrom POJ 1502
- python Bug | ImportError: No module named _curses
- 38、批量改变对象的属性
- BZOJ 1087: [SCOI2005]互不侵犯King 预处理,状压DP
- 1048. Find Coins
- vue 第五节
- Android编程权威指南(第二版)学习笔记(二十)—— 第20章 样式与主题
- Intel 处理器-保护模式
- Java文件上传
- 在安卓设备上运行可视化GUN/linux
- 带分数
- [netty]--分隔符解码器DelimiterBasedFrameDecoder和定长解码器FixedLengthFrameDecoder
- RecyclerView进阶:使用ItemTouchHelper实现拖拽和侧滑删除
- C字符串