uniapp+echarts开发APP版本教程

news2024/11/19 17:22:58

需求

需要在uniapp+echarts展示图表功能,是APP版本,不是小程序。找了好多教程都乱七八糟的,无法实现。以下是效果图

教程

1、安装插件

HBuilder安装echarts插件,插件地址如下。安装完成后在uni_modules/lime-echart文件夹下

https://ext.dcloud.net.cn/plugin?id=4899

2,代码

<template>
	<view class="app-container" style="padding-bottom: 0;">
		<view class="myBody">
			<uni-row style="margin-top: 20px;">
				<uni-col :span="24">
					<view style="width: 100%; height: 220px;background: #fafafa;">
						<l-echart ref="deviceTypesChart" @finished="deviceTypeInit"></l-echart>
					</view>
				</uni-col>
			</uni-row>
			
		</view>

	</view>

</template>
<script>
	import * as echarts from '@/uni_modules/lime-echart/static/echarts.min';



	export default {
		name: "IndexPhone",
		components: {
		},
		data() {
			return {
				
			}
		},
		created() {
			
		},
		onReady() {

		},

		onLoad() {
		},
		methods: {
			deviceTypeInit() {
				var _this = this;
				uni.request({
					url: _this.api + '/getDeviceStatusNum',
					method: 'get',
					data: '',
					header: {
						'Content-Type': 'application/json',
						'Authorization': "Bearer " + uni.getStorageSync("loginToken"),
						'language': uni.getStorageSync("flowinnIotLanguage")
					},
					success: function(res) {
						var response = res.data;
						let deviceTypes = response.rows;
						let option = {
						  tooltip: {
							trigger: 'item'
						  },
						  legend: {
							top: '3px',
							left: 'center'
						  },
						  // 关闭,远控,禁用,近控
						  color:['#a0a1a3','#4fb989','#f55b83','#58c3fb'],
						  series: [
							{
							  name: "设备使能状态统计",
							  type: 'pie',
							  radius: ['38%', '60%'],
							  avoidLabelOverlap: false,
							  itemStyle: {
								borderRadius: 10,
								borderColor: '#fff',
								borderWidth: 2
							  },
							  label: {
								show: false,
								position: 'center'
							  },
							  emphasis: {
								label: {
								  show: true,
								  fontSize: 20,
								  fontWeight: 'bold'
								}
							  },
							  labelLine: {
								show: false
							  },
							  data: deviceTypes
							}
						  ]
						};
						_this.$refs.deviceTypesChart.init(echarts, chartObj => {
							chartObj.setOption(option);
						});
					},
					fail: function(err) {
						console.error(err);
					}
				});

			},
			
			
		},
		mounted() {

		},
	};
</script>


<style rel="stylesheet/scss">

</style>


3、option官网

打开echarts官网,然后选择自己的图表

https://echarts.apache.org/examples/zh/index.html

打开后, 直接复制option,然后替换data就行。

 

结束

-----华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码-----

-----华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码-----

-----华丽的分割线,以下是凑字数,大家不用花时间看,快去改代码-----

package cn.renkai721.bean.vo;
 
import lombok.extern.slf4j.Slf4j;
 
@Slf4j
public class MakeUpTheWordCount {
 
    private String make_up_the_word_count_column_999999999_1;
    private String make_up_the_word_count_column_999999999_2;
    private String make_up_the_word_count_column_999999999_3;
    private String make_up_the_word_count_column_999999999_4;
    private String make_up_the_word_count_column_999999999_5;
    private String make_up_the_word_count_column_999999999_6;
    private String make_up_the_word_count_column_999999999_7;
    private String make_up_the_word_count_column_999999999_8;
    private String make_up_the_word_count_column_999999999_9;
    private String make_up_the_word_count_column_999999999_10;
    private String make_up_the_word_count_column_999999999_11;
    private String make_up_the_word_count_column_999999999_12;
    private String make_up_the_word_count_column_999999999_13;
    private String make_up_the_word_count_column_999999999_14;
    private String make_up_the_word_count_column_999999999_15;
    private String make_up_the_word_count_column_999999999_16;
    private String make_up_the_word_count_column_999999999_17;
    private String make_up_the_word_count_column_999999999_18;
    private String make_up_the_word_count_column_999999999_19;
    private String make_up_the_word_count_column_999999999_20;
 
    public String getMake_up_the_word_count_column_999999999_1() {
        return make_up_the_word_count_column_999999999_1;
    }
 
    public void setMake_up_the_word_count_column_999999999_1(String make_up_the_word_count_column_999999999_1) {
        this.make_up_the_word_count_column_999999999_1 = make_up_the_word_count_column_999999999_1;
    }
 
    public String getMake_up_the_word_count_column_999999999_2() {
        return make_up_the_word_count_column_999999999_2;
    }
 
    public void setMake_up_the_word_count_column_999999999_2(String make_up_the_word_count_column_999999999_2) {
        this.make_up_the_word_count_column_999999999_2 = make_up_the_word_count_column_999999999_2;
    }
 
    public String getMake_up_the_word_count_column_999999999_3() {
        return make_up_the_word_count_column_999999999_3;
    }
 
    public void setMake_up_the_word_count_column_999999999_3(String make_up_the_word_count_column_999999999_3) {
        this.make_up_the_word_count_column_999999999_3 = make_up_the_word_count_column_999999999_3;
    }
 
    public String getMake_up_the_word_count_column_999999999_4() {
        return make_up_the_word_count_column_999999999_4;
    }
 
    public void setMake_up_the_word_count_column_999999999_4(String make_up_the_word_count_column_999999999_4) {
        this.make_up_the_word_count_column_999999999_4 = make_up_the_word_count_column_999999999_4;
    }
 
    public String getMake_up_the_word_count_column_999999999_5() {
        return make_up_the_word_count_column_999999999_5;
    }
 
    public void setMake_up_the_word_count_column_999999999_5(String make_up_the_word_count_column_999999999_5) {
        this.make_up_the_word_count_column_999999999_5 = make_up_the_word_count_column_999999999_5;
    }
 
    public String getMake_up_the_word_count_column_999999999_6() {
        return make_up_the_word_count_column_999999999_6;
    }
 
    public void setMake_up_the_word_count_column_999999999_6(String make_up_the_word_count_column_999999999_6) {
        this.make_up_the_word_count_column_999999999_6 = make_up_the_word_count_column_999999999_6;
    }
 
    public String getMake_up_the_word_count_column_999999999_7() {
        return make_up_the_word_count_column_999999999_7;
    }
 
    public void setMake_up_the_word_count_column_999999999_7(String make_up_the_word_count_column_999999999_7) {
        this.make_up_the_word_count_column_999999999_7 = make_up_the_word_count_column_999999999_7;
    }
 
    public String getMake_up_the_word_count_column_999999999_8() {
        return make_up_the_word_count_column_999999999_8;
    }
 
    public void setMake_up_the_word_count_column_999999999_8(String make_up_the_word_count_column_999999999_8) {
        this.make_up_the_word_count_column_999999999_8 = make_up_the_word_count_column_999999999_8;
    }
 
    public String getMake_up_the_word_count_column_999999999_9() {
        return make_up_the_word_count_column_999999999_9;
    }
 
    public void setMake_up_the_word_count_column_999999999_9(String make_up_the_word_count_column_999999999_9) {
        this.make_up_the_word_count_column_999999999_9 = make_up_the_word_count_column_999999999_9;
    }
 
    public String getMake_up_the_word_count_column_999999999_10() {
        return make_up_the_word_count_column_999999999_10;
    }
 
    public void setMake_up_the_word_count_column_999999999_10(String make_up_the_word_count_column_999999999_10) {
        this.make_up_the_word_count_column_999999999_10 = make_up_the_word_count_column_999999999_10;
    }
 
    public String getMake_up_the_word_count_column_999999999_11() {
        return make_up_the_word_count_column_999999999_11;
    }
 
    public void setMake_up_the_word_count_column_999999999_11(String make_up_the_word_count_column_999999999_11) {
        this.make_up_the_word_count_column_999999999_11 = make_up_the_word_count_column_999999999_11;
    }
 
    public String getMake_up_the_word_count_column_999999999_12() {
        return make_up_the_word_count_column_999999999_12;
    }
 
    public void setMake_up_the_word_count_column_999999999_12(String make_up_the_word_count_column_999999999_12) {
        this.make_up_the_word_count_column_999999999_12 = make_up_the_word_count_column_999999999_12;
    }
 
    public String getMake_up_the_word_count_column_999999999_13() {
        return make_up_the_word_count_column_999999999_13;
    }
 
    public void setMake_up_the_word_count_column_999999999_13(String make_up_the_word_count_column_999999999_13) {
        this.make_up_the_word_count_column_999999999_13 = make_up_the_word_count_column_999999999_13;
    }
 
    public String getMake_up_the_word_count_column_999999999_14() {
        return make_up_the_word_count_column_999999999_14;
    }
 
    public void setMake_up_the_word_count_column_999999999_14(String make_up_the_word_count_column_999999999_14) {
        this.make_up_the_word_count_column_999999999_14 = make_up_the_word_count_column_999999999_14;
    }
 
    public String getMake_up_the_word_count_column_999999999_15() {
        return make_up_the_word_count_column_999999999_15;
    }
 
    public void setMake_up_the_word_count_column_999999999_15(String make_up_the_word_count_column_999999999_15) {
        this.make_up_the_word_count_column_999999999_15 = make_up_the_word_count_column_999999999_15;
    }
 
    public String getMake_up_the_word_count_column_999999999_16() {
        return make_up_the_word_count_column_999999999_16;
    }
 
    public void setMake_up_the_word_count_column_999999999_16(String make_up_the_word_count_column_999999999_16) {
        this.make_up_the_word_count_column_999999999_16 = make_up_the_word_count_column_999999999_16;
    }
 
    public String getMake_up_the_word_count_column_999999999_17() {
        return make_up_the_word_count_column_999999999_17;
    }
 
    public void setMake_up_the_word_count_column_999999999_17(String make_up_the_word_count_column_999999999_17) {
        this.make_up_the_word_count_column_999999999_17 = make_up_the_word_count_column_999999999_17;
    }
 
    public String getMake_up_the_word_count_column_999999999_18() {
        return make_up_the_word_count_column_999999999_18;
    }
 
    public void setMake_up_the_word_count_column_999999999_18(String make_up_the_word_count_column_999999999_18) {
        this.make_up_the_word_count_column_999999999_18 = make_up_the_word_count_column_999999999_18;
    }
 
    public String getMake_up_the_word_count_column_999999999_19() {
        return make_up_the_word_count_column_999999999_19;
    }
 
    public void setMake_up_the_word_count_column_999999999_19(String make_up_the_word_count_column_999999999_19) {
        this.make_up_the_word_count_column_999999999_19 = make_up_the_word_count_column_999999999_19;
    }
 
    public String getMake_up_the_word_count_column_999999999_20() {
        return make_up_the_word_count_column_999999999_20;
    }
 
    public void setMake_up_the_word_count_column_999999999_20(String make_up_the_word_count_column_999999999_20) {
        this.make_up_the_word_count_column_999999999_20 = make_up_the_word_count_column_999999999_20;
    }
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1358631.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

MySQL卸载-Windows版

MySQL卸载 1. 停止Mysql服务2. 卸载Mysql相关组件3. 删除Mysql安装目录4. 删除Mysql数据目录5. 再次打开服务&#xff0c;查看是否有Mysql卸载残留 1. 停止Mysql服务 winR 打开运行&#xff0c;输入 services.msc 点击 “确定” 调出系统服务。 2. 卸载Mysql相关组件 打开控制…

基于SpringBoot+thymeleaf的养老院管理系统(Java毕业设计)

大家好&#xff0c;我是DeBug&#xff0c;很高兴你能来阅读&#xff01;作为一名热爱编程的程序员&#xff0c;我希望通过这些教学笔记与大家分享我的编程经验和知识。在这里&#xff0c;我将会结合实际项目经验&#xff0c;分享编程技巧、最佳实践以及解决问题的方法。无论你是…

ELF解析02 - linker

01里面&#xff0c;我们看到了修改后的 ls 程序在 maps 里面的布局&#xff1a; 在 01 里面&#xff0c;我们说到&#xff0c;r—p 这个段是一个 padding 段&#xff0c;但是实际上不是的。 我们一行行介绍&#xff0c;从第一行看起&#xff1a; 5fde6d4000-5fde731000 r-xp …

洗地机什么牌子最好?洗地机口碑榜

洗地机融合了吸尘、拖地、洗地和消毒功能&#xff0c;实现了一体化的清洁解决方案。它能够同时进行多种清洁动作&#xff0c;从而在一次操作中高效完成吸尘、拖地、洗地和消毒清洁任务&#xff0c;大大提高了清洁效率。但是面对面目琳琅的洗地机&#xff0c;我们该如何去挑选呢…

CDMP考试解析:从报名到成功不走弯路

❤️CDMP数据管理专业认证是由DAMA国际于2004推出&#xff0c;是一项涵盖学历教育、工作经验和专业知识考试在内的综合资格认证&#xff0c;也是目前全球wei一数据管理方面权威性认证。 &#x1f4b0;考试费用&#xff1a;CDMP的考试费用约为每科2500元。 其他可能的费用&#…

C语言KR圣经笔记 5.7多维数组 5.8指针数组初始化 5.9指针vs多维数组

5.7 多维数组 C 提供了矩形的多维数组&#xff0c;虽然实际上它们用得比指针数组少得多。本节我们将展示多维数组的一些特性。 考虑下日期转换的问题&#xff1a;把某月的第几天转换为当年的第几天&#xff0c;以及反向转换。例如&#xff0c;3月1日是非闰年的第60天&#xf…

CG Magic分享3d max渲染效果图时,不可忽略的灯光技巧!

一幅效果图是否能够呈现更完美&#xff0c;不止是完美的模型基础&#xff0c;而且灯光的设置也不能忽视。 尤其&#xff0c;对于3dmax室内灯光渲染还是很重要的&#xff0c;对于新手伙伴来说&#xff0c;可能会想到的3dmax怎么打灯渲染&#xff1f; 3dmax灯光渲染设置需要注意…

CSS基础笔记-01CSS概述

文章目录 前言CSS是什么CSS的作用CSS语法添加CSS的方法 前言 CSS是什么&#xff1f;有什么作用&#xff1f;怎么编写CSS&#xff1f;怎样添加CSS&#xff1f;本文对CSS的四个方面作了学习并形成学习笔记。 CSS是什么 CSS &#xff08;Cascading Style Sheets&#xff0c;层叠…

vite环境变量的坑

最近在写项目的时候&#xff0c;遇到这么一个bug。直接看图&#xff1a; 这是我启动项目的时候vscode的提示&#xff1a; 然后默认自动打开浏览器 是不是发现bug了。你们绝对想不到这个bug是什么。我直接说吧。 这个bug来着一个环境变量&#xff0c;这个变量用来配置是否默认…

Mac 软件出现「意外退出」及「打不开」解决方法

Mac 软件出现「意外退出」及「打不开」解决方法 软件出现意外退出及软件损坏的情况&#xff0c;这是因为苹果删除了TNT的证书&#xff0c;所以大部分TNT破解的Mac软件会出现无法打开&#xff0c;提示意外退出。 终端需先安装Xcode或Apple命令行工具 如未装Xcode可以使用下列命…

SWM341系列之86盒智能开关应用

SWM341系列 86盒智能开关应用 华芯微特SWM341系列的SWM34SRET6&#xff0c;在86盒智能开关产品中的应用。 SWM34SRET6性能和UI的描述 SWM34SRET6是一款基于ARM Cortex-M33内核&#xff0c;最高主频可达150MHz时钟&#xff0c;提供内置512KB Flash&#xff0c;64KB SRAM&#…

给出一句话来描述想要的图片,就能从图库中搜出来符合要求的

介绍 地址&#xff1a;https://github.com/mazzzystar/Queryable The open-source code of Queryable, an iOS app, leverages the OpenAIs CLIP model to conduct offline searches in the Photos album. Unlike the category-based search model built into the iOS Photos…

js逆向第8例:猿人学第1题-js 混淆-源码乱码

题目1:抓取所有(5页)机票的价格,并计算所有机票价格的平均值,填入答案。 老规矩打开控制台调试,出现debugger 过掉这个很简单了,右键点击“一律不在此处暂停” 这样就可以查看具体的网络请求如下: m是加密值,熟悉的大佬能发现这串加密字符非常像md5,|后面的就是时…

linux 浅练一下哈

1.新建用户test不建家目录不允许登录&#xff0c;uid为10086_____________________ useradd -u 10086 -M -s /sbin/nologin 2.将 /opt 文件夹中所有文件的属主&#xff0c;属组改成&#xff0c;test_______________________ chown -R test.test /opt chown -R …

【基础篇】十三、强软弱虚引用、终结器引用

文章目录 0、相关&#x1f58a;1、强引用2、软引用3、弱引用4、虚引用5、终结引用 关于对象能否被回收&#xff1a; 计数器可达性分析 还可以根据引用的类型&#xff0c;不同的引用类型&#xff0c;对应对象的不同GC回收规则。 0、相关&#x1f58a; &#x1f4d5;【强软弱虚…

【HarmonyOS开发】ArkUI-X 跨平台框架(使用ArkTs开发AndroidIOS)

ArkUI-X 跨平台框架进一步将 ArkUI 开发框架扩展到了多个OS平台&#xff0c;目前支持OpenHarmony、HarmonyOS、Android、 iOS&#xff0c;后续会逐步增加更多平台支持。开发者基于一套主代码&#xff0c;就可以构建支持多平台的精美、高性能应用。 一、跨平台框架有哪些? 1、…

java发送邮件到qq邮箱

自己的授权码自己记好 引入依赖 <dependency><groupId>com.sun.mail</groupId><artifactId>javax.mail</artifactId><version>1.6.2</version> </dependency> <dependency><groupId>javax.mail</groupId>&…

[C#]使用OpenCvSharp实现区域文字提取

【官方框架地址】 github.com/shimat/opencvsharp 【算法介绍】 采用opencv算法实现文字区域提取&#xff0c;步骤如下&#xff1a; &#xff08;1&#xff09;形态学操作 &#xff08;2&#xff09;查找轮廓 &#xff08;3&#xff09;筛选那些面积小的 &#xff08;4&#…

【AI】人类视觉感知特性与深度学习模型(1/2)

目录 一、关于人类视觉感知 1.1 视觉关注 1.自上而下&#xff08;Top-down&#xff09;的视觉关注 ​编辑 2.自下而上&#xff08;Bottom-up&#xff09;的视觉关注 3.区别和记忆点 1.2 视觉掩盖 1.常见的视觉掩盖效应 2.恰可识别失真&#xff08;Just Noticeable Dif…

缓存数据库一致性问题

为什么使用缓存&#xff1f; 业务处于起步阶段&#xff0c;流量非常小&#xff0c;那无论是读请求还是写请求&#xff0c;直接操作数据库随着业务指数级增长&#xff0c;请求量剧增&#xff0c;直接访问数据库&#xff0c;导致性能急剧下降&#xff0c;需要引入缓存提高读性能…