echart 人头
2019-11-04 09:31:43来源:博客园 阅读 ()
echart 人头
<template> <div :class="className"> <div :id="id" class="spiritChartBox"></div> </div> </template> <script> import { mapState } from "vuex"; import echarts from "@/utils/initEcharts"; import deepMerge from "@/utils/deepMerge"; export default { name: "spiritChart", props: { className: { type: String, default: "spiritChartBox" }, id: { type: String, default: "spiritChart" }, options: { type: Object, default: function() { return {}; } } }, data() { return { chart: null }; }, watch: { options() { this.setOption(); }, clientWidth() { this.setOption(); } }, mounted() { const self = this; self.initChart(); }, computed: { ...mapState({ clientWidth: state => state.init.clientWidth }) }, methods: { initChart() { const self = this; self.chart = echarts.init(document.getElementById(self.id)); window.addEventListener("resize", () => { self.chart.resize(); }); self.setOption(); }, setOption() { const self = this; const { options, clientWidth } = self; const maxData = 100; const spirit = "image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAA+CAYAAADeQLDtAAAACXBIWXMAAAsSAAALEgHS3X78AAABpElEQVRYhe2YQU6EMBSGf4n7coTxBHoAFrhg7dxAvcEcAW/g3ABP4Ljuxkk4gNwAb1BOgHljIQ22fR2GMcb0Twjh9ZWvpS389KLve3Aq6u4GQAngzkhtKCYzsePqs5Ci7tYAXj0pjzIT1WxIUXcpgBaAYBp7KzPx7ipMmMoPAYAhzykOkgcA2DwOkgZCvHkc5CMQ4s3jIN5ZE5rnhchMUAu3DKDhpjDXEwJtADw5it9CJkfQisf3mlnpG9JZAdjJTLQhdYMhp+jSvCjqLj9ibfjUmuM09qSoOwreL9gBeoHmMhMq0YByYQDpepjah54UdacC31FzdJXocTgXgLRm18kCSn8Dwq/4c0Kamfez1nNBNjMh1nr/f0wiJEIiJEL+OkRZ4kHO0KHPSVgl2lS/GMFtqP10qDTC9BGrTHNHrkVpKF3P8a+Hf0ftm1fDf+RoU30/ltMbAXjW5s0q/STGp3H07NKNsY2jU3HFR0iEREiEREiEnAIZ7I7r82uN+yC2vUcyEObZ1H5wOlNx2+i0c00HtbAyN/+1haIysj8Up/KfPQHwBdyuiCoNTDAkAAAAAElFTkSuQmCC"; self.chart.setOption({ title: { text: "景区饱和度", x: "center", y: "15%", textStyle: { color: "#fff", fontSize: 24, fontWeight: 600 } }, tooltip: { show: false }, xAxis: { max: maxData, splitLine: { show: false }, axisTick: { show: false }, axisLine: { show: false }, axisLabel: { show: false } }, yAxis: { data: options.yAxisData || [], inverse: true, axisTick: { show: false }, axisLine: { show: false }, axisLabel: { formatter: val => { const strArr = val.split("_"); return `{a|${strArr[0]}}\n{b|${strArr[1]}}`; }, rich: { a: { color: "#fff", fontSize: 12, lineHeight: 20 }, b: { color: "#fbee21", fontSize: 16 } } } }, grid: { top: "25%", height: "60%", width: "43%", right: "10%" }, series: [ { type: "pictorialBar", symbol: spirit, symbolRepeat: "fixed", symbolMargin: "15%", symbolClip: true, symbolSize: [15, 30], symbolBoundingData: maxData, data: options.seriesData || [], z: 10 }, { type: "pictorialBar", itemStyle: { normal: { opacity: 0.2 } }, animationDuration: 0, symbolRepeat: "fixed", symbolMargin: "15%", symbol: spirit, symbolSize: [15, 30], symbolBoundingData: maxData, data: options.seriesData || [], z: 5 } ] }); } } }; </script> <style scoped> .spiritChartBox { width: 100%; height: 100%; } </style>
原文链接:https://www.cnblogs.com/Byme/p/11790755.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
- ECharts安装与使用 2020-05-26
- ECharts介绍 2020-05-26
- 解决微信小程序引用echarts视图模糊的问题 2020-04-24
- Echarts快速入门 2020-04-09
- echarts字体适配 2019-05-10
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash