• 带圆点的仪表盘


    <template>
    	<div id="openLeftOneTl" style=" 100%; height: 100%;"></div>
    </template>
    
    <script>
    	export default {
    		data() {
    			return {
    
    			}
    		},
    		mounted() {
    			this.myecharts();
    			this.WidthAdaptive();
    		},
    		watch: {
    
    		},
    		methods: {
    			WidthAdaptive(res) {
    				var windth = window.screen.width;
    				let fontSize = windth / 4422;
    				return fontSize * res;
    			},
    			myecharts() {
    				let myChart = this.$echarts.init(document.getElementById('openLeftOneTl'));
    
    				let score = 100,
    					maxScore = 180,
    					scoresPercentage = score / maxScore;
    
    				let title = '城市低保情况'
    				let percent = (scoresPercentage * 100).toFixed(2)
    
    				var option = {
    					title: {
    						text: title,
    						subtext: score,
    						left: 'center',
    						bottom: "15%",
    						itemGap: this.WidthAdaptive(20),
    						textStyle: {
    							fontSize: this.WidthAdaptive(13),
    							color: '#ffffff',
    						},
    						subtextStyle: {
    							fontSize: this.WidthAdaptive(31),
    							fontFamily: 'YouSheBiaoTiHei',
    							color: '#ffffff',
    						}
    					},
    					series: [{
    							type: 'gauge',
    							startAngle: 180,
    							endAngle: 0,
    							radius: '150%',
    							center: ['50%', '80%'],
    							splitNumber: 26,
    							detail: {
    								offsetCenter: [0, 0],
    								formatter: ' ',
    							},
    							pointer: {
    								show: false,
    							},
    							axisLine: {
    								show: true,
    								lineStyle: {
    									color: [
    										[1, 'rgba(5, 117, 230, 0.3)']
    									],
    									 this.WidthAdaptive(20),
    								},
    							},
    							axisTick: {
    								show: false,
    							},
    							splitLine: {
    								show: false,
    							},
    							axisLabel: {
    								show: false,
    							},
    						},
    						// 仪表盘值得渐变
    						{
    							type: 'pie',
    							zlevel: 10,
    							radius: ['128%', '144%'],
    							center: ['50%', '80%'],
    							silent: true,
    							animationDuration: 1500,
    							animationEasing: "cubicInOut",
    							startAngle: 180,
    							endAngle: 0,
    							label: {
    								show: false,
    							},
    							labelLine: {
    								show: false,
    							},
    							data: [{
    									name: '',
    									value: scoresPercentage,
    									itemStyle: {
    										color: '#389BFE',
    									},
    								},
    								{
    									value: 2 - scoresPercentage,
    									itemStyle: {
    										opacity: 0,
    										color: 'rgba(255, 255, 255, 0)',
    									},
    								},
    							],
    						},
    						// 值得尾巴,那个圆圈
    						{
    							type: 'pie',
    							radius: ['115%', '150%'],
    							center: ['50%', '80%'],
    							zlevel: 10,
    							silent: true,
    							animationDuration: 1500,
    							animationEasing: "cubicInOut",
    							startAngle: 180,
    							endAngle: 0,
    							data: [{
    									name: '',
    									value: scoresPercentage,
    									label: {
    										show: false,
    									},
    									labelLine: {
    										show: false,
    									},
    									itemStyle: {
    										color: 'rgba(0,0,0,0)',
    									},
    								},
    
    								// 画中间的图标
    								{
    									name: '',
    									value: 0,
    									label: {
    										position: 'inside',
    										backgroundColor: '#389BFE',
    										borderRadius: this.WidthAdaptive(10),
    										padding: this.WidthAdaptive(10), // 可以控制圆的大小
    										borderWidth: this.WidthAdaptive(14),
    										borderColor: 'rgba(56,155,254,.3)',
    									},
    								},
    								{
    									name: '',
    									value: 2 - scoresPercentage,
    									label: {
    										show: false,
    									},
    									labelLine: {
    										show: false,
    									},
    									itemStyle: {
    										color: 'rgba(255,255,255,0)',
    									},
    								},
    							],
    						},
    					],
    				};
    
    
    				myChart.setOption(option);
    
    				window.onresize = myChart.resize;
    			}
    		},
    	}
    </script>
    
    <style>
    
    </style>
    

      

  • 相关阅读:
    《CMake实践》笔记二:INSTALL/CMAKE_INSTALL_PREFIX
    《CMake实践》笔记一:PROJECT/MESSAGE/ADD_EXECUTABLE
    《CMake实践》第三部分的示例代码的错误
    利用 autoconf 和 automake 生成 Makefile 文件
    如何安装 罗技“优联技术”无线鼠标、无线键盘?
    make 和 makefile 的关系
    编译器 cc、gcc、g++、CC 的区别
    如何撤销 PhpStorm/Clion 等 JetBrains 产品的 “Mark as Plain Text” 操作 ?
    Linux/Ubuntu tree 命令以树形结构显示文件夹目录结构
    C/C++ 静态链接库(.a) 与 动态链接库(.so)
  • 原文地址:https://www.cnblogs.com/a973692898/p/16067516.html
Copyright © 2020-2023  润新知