带【科技感】的Echarts 图表

请添加图片描述
Echarts脚本在线地址 https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js


引入Echarts 脚本后粘贴代码

vue2 代码:

<template><div><div ref="col-2-row-2" class="col-2-row-2"></div></div>
</template>
<script>
export default {data() {return {config: {list: [{name: "垃圾治理", id: "scene_type_2", value: 11},{name: "生活垃圾", id: "random_clap_type_3", value: 5},{name: "水域治理", id: "scene_type_5", value: 1},{name: "生活污水", id: "random_clap_type_2", value: 4},{name: "文明乡风", id: "random_clap_type_6", value: 10},{name: "农业废弃物", id: "random_clap_type_4", value: 2},{name: "农村厕所", id: "random_clap_type_1", value: 6},{name: "其他问题", id: "random_clap_type_7", value: 0},{name: "基础设施", id: "scene_type_3", value: 6},{name: "村容村貌", id: "scene_type_1", value: 19},{name: "蓝天守卫", id: "scene_type_4", value: 2},]}}},methods: {initEcharts(dom, config, fn) {let _self = this, angle = 0, myChartif (this.$echarts.init) {myChart = this.$echarts.init(dom, null);} else {myChart = this.$echarts(dom, null);}setInterval(() => {angle = angle + 3let option = fn(_self, config, angle)myChart.setOption(option, true);// eslint-disable-next-line no-undef// tools.loopShowTooltip(myChart, option, {loopSeries: true});}, 120);},col2row2(vm, config = {}, angle = 0){let data = [];//角度,用来做简单的动画效果的let { list = [] } = configlet _self = this;let img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMYAAADGCAYAAACJm/9dAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8x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bVrGMRs/sT+jciXj/bQVwLHrmS7M3LT2qTRghT6ORkcODdEhfNAeyFB0schmwY+bWlT9D0LN5DT2rSejZhTyNnu0hwILMrcuAahVGyGJUe3wdHWnbEntvX7SP+F3gMbTUZAC1ywAkgMfQGqZb0TMKaUHP8OvomS7O1rxsqWtdUlOLVoejGdnzgD0S3v8IreGZi4I0fJydabmwHWoKTUR9tKRBitXo0MefkVI4zDxpam5MfL3WhBFSj/Z/nI/W7DQkXNOCdpE9jbbhVsSMbTcYARwFHI2aQ4X+748jQTQDWzKzLmMKCaNv4qvVzxbg2eBve/SLeTowjmg3WQP6NT02yL+Lmg/Lgr9VRGGAypU+SAijg7/DgF0LXLsZiWA2Cp68PgP7ypZarTEKMQzVIOPRr+rWJgivRkPA5cxVaIi1EJ+i2vAJVEOU7WrXtHCN0T3WovU+96DO6OEoksk4FNqn0n9F2tC+iGZUWy4CNuZqUZliYRRmI5pND2fUd0JDwKPRMGVLgfvKiRa0EegF1PxbDnyQq0UVwv8BNYmwIpIWBvwAAAAASUVORK5CYII='let color=['#FF801C', '#F5FF46', '#00FE65', '#00FEFF', '#ffa800', '#ff5b00', '#ff3000']let seriesOption = [{name: '',type: 'pie',clockWise: false,radius: ['33%', '38%'],y: '-25%',hoverAnimation: false,label: {show: true,position: 'outside',color: '#ddd',normal: {show: true,textStyle: {fontSize: 12,color: '#bbd0e8'}},},itemStyle: {normal: {labelLine: {length: 20,length2: 40,show: true,color: '#00ffff',},// 数据 百分比label: {formatter: function (params) {let percent = 0;let total = 0;for (let i = 0; i < list.length; i++) {total += list[i].value;}percent = ((params.value / total) * 100).toFixed(0);if (params.name !== '') {return params.name + ':' + percent + '%';} else {return '';}},}},},data: data,},// 外线{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.65,r: Math.min(api.getWidth(), api.getHeight()) / 3.3,startAngle: ((0 + angle) * Math.PI) / 180,endAngle: ((90 + angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},// 外点{name: 'ring5', //紫点type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;let point = _self.getCirlPoint(x0, y0, r, 90 + angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //绿fill: '#00FEFF',},silent: true,};},data: [0],},// 外线{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.68,r: Math.min(api.getWidth(), api.getHeight()) / 3.3,startAngle: ((180 + angle) * Math.PI) / 180,endAngle: ((270 + angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},// 蓝色 -- 外点{name: 'ring5', type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;let point = _self.getCirlPoint(x0, y0, r, 180 + angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //绿fill: '#00FEFF',},silent: true,};},data: [0],},{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.68,r: Math.min(api.getWidth(), api.getHeight()) / 3.8,startAngle: ((270 + -angle) * Math.PI) / 180,endAngle: ((40 + -angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},// 橘色{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.68,r: Math.min(api.getWidth(), api.getHeight()) / 3.8,startAngle: ((90 + -angle) * Math.PI) / 180,endAngle: ((220 + -angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;let point = _self.getCirlPoint(x0, y0, r, 90 + -angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //粉fill: '#00FEFF',},silent: true,};},data: [0],},{name: 'ring5', //绿点type: 'custom',coordinateSystem: 'none',renderItem: function (params, api) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;let point = _self.getCirlPoint(x0, y0, r, 270 + -angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //绿fill: '#00FEFF',},silent: true,};},data: [0],},];for (let i = 0; i < list.length; i++) {data.push({value: list[i].value,name: list[i].name,itemStyle: {normal: {borderWidth: 5,shadowBlur: 20,borderColor: color[i],shadowColor: color[i],},},},{value: 2,name: '',itemStyle: {label: {show: false,},normal: {labelLine: {show: false,},color: 'rgba(0, 0, 0, 0)',borderColor: 'rgba(0, 0, 0, 0)',borderWidth: 0,},},})}return {color,title: {text: '问题类型',textAlign: 'center',left: '49%',top: '34%',textStyle: {fontWeight: 'normal',fontSize: 14,color: '#bbd0e8',textAlign: 'center',},},// 内环graphic: {elements: [{type: 'image',z: 3,style: {image: img,width: 80,height: 80,},left: 'center',top: '25%',position: [100, 100],},],},tooltip: {show: false,},legend: {icon: 'circle',orient: 'horizontal',y: '76%',data: list.map(i => i.name),align: 'left',textStyle: {fontSize: 12,color: '#bbd0e8',},itemGap: 5,},toolbox: {show: false,},series: seriesOption,};},//获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度)getCirlPoint(x0, y0, r, angle) {let x1 = x0 + r * Math.cos(angle * Math.PI / 180)let y1 = y0 + r * Math.sin(angle * Math.PI / 180)return {x: x1,y: y1}}},mounted() {let _self = this;_self.$nextTick(() => {_self.initEcharts(_self.$refs['col-2-row-2'], _self.config, _self.col2row2)})}
}
</script>
<style lang="scss" scoped>
.col-2-row-2 {width: 400px;height: 300px;background-color: rgb(4, 36, 63);
}
</style>

因为Vue2 停止维护了嘛,所以我们要与时俱进。


Vue3 + Ts 版本:

需要注意:
this.dom.getContext is not a function
这个报错是指图表的实例对象只能通过document 获取,不可以用ref<'ElFormInstance>()
也就是27行和30行

“echarts”指 UMD 全局,但当前文件是模块。请考虑改为添加导入
这句说的是echarts应该通过全局引入的方式,可以通过npm安装echarts 解决,也可以在适当的位置全局引入echarts 脚本

<template><div class="p-2"><div ref="col2Row2" class="col-2-row-2"></div></div>
</template><script setup name="echarts" lang="ts">
import { getCurrentInstance, ref } from 'vue';// 数据列表
const config = reactive({list: [{name: "垃圾治理", id: "scene_type_2", value: 11},{name: "生活垃圾", id: "random_clap_type_3", value: 5},{name: "水域治理", id: "scene_type_5", value: 1},{name: "生活污水", id: "random_clap_type_2", value: 4},{name: "文明乡风", id: "random_clap_type_6", value: 10},{name: "农业废弃物", id: "random_clap_type_4", value: 2},{name: "农村厕所", id: "random_clap_type_1", value: 6},{name: "其他问题", id: "random_clap_type_7", value: 0},{name: "基础设施", id: "scene_type_3", value: 6},{name: "村容村貌", id: "scene_type_1", value: 19},{name: "蓝天守卫", id: "scene_type_4", value: 2},]
})
// 图表ref
const col2Row2 = ref<ElFormInstance>();onMounted(() => {initEcharts(document.querySelector('.col-2-row-2'), config, row2Config)
})// 初始化
const initEcharts = (dom: any, config: Object, fn: Function) => {let _self = this, angle = 0;let myChart = echarts.init(dom, undefined);setInterval(() => {angle = angle + 3let option = fn(_self, config, angle)myChart.setOption(option, true);// eslint-disable-next-line no-undef// tools.loopShowTooltip(myChart, option, {loopSeries: true});}, 120);
}// 配置
const row2Config = (vm:any, config = {list: []}, angle = 0) => {let data:any = [];//角度,用来做简单的动画效果的let { list = [{value: '', name: ''}] } = configlet _self = this;let img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMYAAADGCAYAAACJm/9dAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzggNzkuMTU5ODI0LCAyMDE2LzA5LzE0LTAxOjA5OjAxICAgICAgICAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+IEmuOgAAE/9JREFUeJztnXmQVeWZxn/dIA2UgsriGmNNrEQNTqSio0IEFXeFkqi4kpngEhXjqMm4MIldkrE1bnGIMmPcUkOiIi6gJIragLKI0Songo5ZJlHGFTADaoRuhZ4/nnPmnO4+l+7bfc85d3l+VV18373n3Ptyvve53/5+da1L6jDdYjgwBhgNHALMBn6Sq0VdcxlwGvACsAx4HliTq0VlRlNzY+LrfTO2o5LoDxwOHAmMA/4WiP+KzM3DqCJpAA4K/i4F2oBXgWbgWWAxsDEv48oZC6M9Q4EJwInAMcDAfM0pOXXA14K/y4FPgQXAfOBxYF1+ppUXFgYMBiYCp6PaoU+B694HFqEmyVJgVSbW9Y6bgCeBb6Am4GHALrH3B6L/+0RgM6pFHgQeAzZkaWi5UVejfYx64AjgXOAk1OToSCtqajyFHGZlVsalzH7oB+BYJJR+Cde0oKbi3cBCYEtWxmV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b00', '#ff3000']let seriesOption = [{name: '',type: 'pie',clockWise: false,radius: ['33%', '38%'],y: '-25%',hoverAnimation: false,label: {show: true,position: 'outside',color: '#ddd',normal: {show: true,textStyle: {fontSize: 12,color: '#bbd0e8'}},},itemStyle: {normal: {labelLine: {length: 20,length2: 40,show: true,color: '#00ffff',},// 数据 百分比label: {formatter: function (params:any) {let percent:number = 0;let total:number = 0;for (let i = 0; i < list.length; i++) {total += +(list[i].value);}percent = +((params.value / total) * 100).toFixed(0);if (params.name !== '') {return params.name + ':' + percent + '%';} else {return '';}},}},},data: data,},// 外线{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.65,r: Math.min(api.getWidth(), api.getHeight()) / 3.3,startAngle: ((0 + angle) * Math.PI) / 180,endAngle: ((90 + angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},// 外点{name: 'ring5', //紫点type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;let point = getCirlPoint(x0, y0, r, 90 + angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //绿fill: '#00FEFF',},silent: true,};},data: [0],},// 外线{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.68,r: Math.min(api.getWidth(), api.getHeight()) / 3.3,startAngle: ((180 + angle) * Math.PI) / 180,endAngle: ((270 + angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},// 蓝色 -- 外点{name: 'ring5', type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.3;let point = getCirlPoint(x0, y0, r, 180 + angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //绿fill: '#00FEFF',},silent: true,};},data: [0],},{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.68,r: Math.min(api.getWidth(), api.getHeight()) / 3.8,startAngle: ((270 + -angle) * Math.PI) / 180,endAngle: ((40 + -angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},// 橘色{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {return {type: 'arc',shape: {cx: api.getWidth() / 2,cy: api.getHeight() / 2.68,r: Math.min(api.getWidth(), api.getHeight()) / 3.8,startAngle: ((90 + -angle) * Math.PI) / 180,endAngle: ((220 + -angle) * Math.PI) / 180,},style: {stroke: '#00FEFF',fill: 'transparent',lineWidth: 1.5,},silent: true,};},data: [0],},{name: 'ring5',type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;let point = getCirlPoint(x0, y0, r, 90 + -angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //粉fill: '#00FEFF',},silent: true,};},data: [0],},{name: 'ring5', //绿点type: 'custom',coordinateSystem: 'none',renderItem: function (params:any, api:any) {let x0 = api.getWidth() / 2;let y0 = api.getHeight() / 2.68;let r = Math.min(api.getWidth(), api.getHeight()) / 3.8;let point = getCirlPoint(x0, y0, r, 270 + -angle);return {type: 'circle',shape: {cx: point.x,cy: point.y,r: 4,},style: {stroke: '#00FEFF', //绿fill: '#00FEFF',},silent: true,};},data: [0],},];for (let i = 0; i < list.length; i++) {data.push({value: list[i].value,name: list[i].name,itemStyle: {normal: {borderWidth: 5,shadowBlur: 20,borderColor: color[i],shadowColor: color[i],},},},{value: 2,name: '',itemStyle: {label: {show: false,},normal: {labelLine: {show: false,},color: 'rgba(0, 0, 0, 0)',borderColor: 'rgba(0, 0, 0, 0)',borderWidth: 0,},},})}return {color,title: {text: '问题类型',textAlign: 'center',left: '49%',top: '34%',textStyle: {fontWeight: 'normal',fontSize: 14,color: '#bbd0e8',textAlign: 'center',},},// 内环graphic: {elements: [{type: 'image',z: 3,style: {image: img,width: 80,height: 80,},left: 'center',top: '25%',position: [100, 100],},],},tooltip: {show: false,},legend: {icon: 'circle',orient: 'horizontal',y: '76%',data: list.map(i => i.name),align: 'left',textStyle: {fontSize: 12,color: '#bbd0e8',},itemGap: 5,},toolbox: {show: false,},series: seriesOption,};
}//获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度)
const getCirlPoint = (x0:number, y0:number, r:number, angle:number) => {let x1 = x0 + r * Math.cos(angle * Math.PI / 180)let y1 = y0 + r * Math.sin(angle * Math.PI / 180)return {x: x1,y: y1}
}</script>
<style lang="scss" scoped>
.col-2-row-2 {width: 400px;height: 300px;background-color: rgb(4, 36, 63);
}
</style>

到底了!原创不易,转载请注明出处。
请添加图片描述

  前端的学习不是一蹴而就,不积跬步无以至千里,不积小流无以成江海。持续不断的努力才能让你我有所收获

推荐阅读:

Vue自定义轮播
Vue动态换肤
css圣诞树 立体模型
vue Tips 轻提示
vue系列自定义加载页
CSS手绘图形

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

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

机器学习笔记:地理加权回归(GWR)

1 传统的线性回归 机器学习笔记&#xff1a;线性回归_线性回归的读书笔记-CSDN博客 最优的β为&#xff1a; 2 地理加权回归&#xff08;GWR&#xff09; 2.1 模型概述 地理加权回归&#xff08;Geographically Weighted Regression&#xff0c;GWR&#xff09;是传统回归分…

【GPU】CUDA是什么?以及学习路线图!

什么是CUDA 作者&#xff1a;Keepin 1、cuda是英伟达开发的一套应用软件接口&#xff08;API&#xff09;。其主要应用于英伟达GPU显卡的调用。 2、云计算可以简单的理解为是通过网络组合成的计算机集群&#xff0c;用于各种加速&#xff0c;其中以CPU为主&#xff0c;GPU为辅…

Spring-AOP

1.概念 AOP(Aspect Oriented Programming)&#xff0c;意为“面向切片编程”&#xff0c;是Spring中一个重要的内容&#xff0c;其本质是动态代理&#xff0c;通过加入切片的方式&#xff0c;降低了各个业务逻辑之间的耦合度&#xff0c;让原生代码更加具有专一性 画个图方便理…

线性表--栈

1.什么是栈&#xff1f; 栈是一种特殊的线性表&#xff0c;其只允许在固定的一端进行插入和删除元素操作。进行数据插入和删除 操作的一端称为栈顶&#xff0c;另一端称为栈底。栈中的数据元素遵守后进先出的原则。 压栈&#xff1a;栈的插入操作叫做进栈/压栈/入栈&#xff…

智能AI系统开发,专业软件硬件物联网开发公司,探索未来科技新纪元

在信息时代&#xff0c;人工智能&#xff08;AI&#xff09;、物联网等前沿技术日益受到人们的关注。智能AI系统、专业软件硬件物联网开发公司应运而生。今天&#xff0c;我们将向大家介绍一家位于XX城的专业公司&#xff0c;致力于智能AI系统开发和软件硬件物联网领域的创新研…

华清远见作业第三十二天——C++(第一天)

思维导图&#xff1a; 提示并输入一个字符串&#xff0c;统计字符中大写、小写个数、空格个数以及其他字符个数要求使用C风格完成。 代码&#xff1a; #include <iostream> #include<array> using namespace std;int main() {string str;cout << "请输…

用大模型训练实体机器人,谷歌推出机器人代理模型

谷歌DeepMind的研究人员推出了一款&#xff0c;通过视觉语言模型进行场景理解&#xff0c;并使用大语言模型来发出指令控制实体机器人的模型——AutoRT AutoRT可有效地推理自主权和安全性&#xff0c;并扩大实体机器人学习的数据收集规模。在实验中&#xff0c;AutoRT指导超过…

K8s 安装部署-Master和Minion(Node)文档

K8s 安装部署-Master和Minion(Node)文档 操作系统版本&#xff1a;CentOS 7.4 Master &#xff1a;172.20.26.167 Minion-1&#xff1a;172.20.26.198 Minion-2&#xff1a;172.20.26.210&#xff08;后增加节点&#xff09; ETCD&#xff1a;172.20.27.218 先安装部署ETC…

pytorch 实现中文文本分类

&#x1f368; 本文为[&#x1f517;365天深度学习训练营学习记录博客&#x1f366; 参考文章&#xff1a;365天深度学习训练营&#x1f356; 原作者&#xff1a;[K同学啊 | 接辅导、项目定制]\n&#x1f680; 文章来源&#xff1a;[K同学的学习圈子](https://www.yuque.com/mi…

WPF自定义圆形百分比进度条

先看效果图 1.界面代码 <UserControl x:Class"LensAgingTest.CycleProcessBar1"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/2006/xaml"xmlns:mc"http://schemas.op…

Java研学-代理模式

一 概述 1 分类 静态代理&#xff1a;在程序运行前就已经存在代理类的字节码文件&#xff0c;代理对象和真实对象的关系在运行前就确定了。&#xff08;代理类及对象要自行创建&#xff09;   动态代理&#xff1a;代理类是在程序运行期间由 JVM 通过反射等机制动态的生成的…

朴素贝叶斯分类算法

1.分类算法 分类算法是有监督学习的一个核心问题&#xff0c;他从数据中学习一个分类决策函数或分类模型&#xff0c;对新的输入进行预测&#xff0c;输出变量取有限个离散值。 &#x1f30d;分类算法的内容是要求给定特征&#xff0c;让我们得出类别。 那么如何由指定特征&…

Asp.Net Core 获取应用程序相关目录

在ASP.NET Core中&#xff0c;可以通过以下三种方式获取应用程序所在目录&#xff1a; 1、使用AppContext.BaseDirectory属性&#xff1a; string appDirectory AppContext.BaseDirectory; 例如&#xff1a;D:\后端项目\testCore\test.WebApi\bin\Debug\net6.0\ 2、使用…

Leetcode刷题笔记题解(C++):LCR 153. 二叉树中和为目标值的路径

思路&#xff1a;利用回溯的思想&#xff0c;回溯的退出条件为当前节点为空&#xff0c;是符合路径的判断条件为路径和为目标值且叶子节点包含了&#xff0c;代码如下&#xff1a; /*** Definition for a binary tree node.* struct TreeNode {* int val;* TreeNode *…

【C++】入门基础

前言&#xff1a;C是在C的基础之上&#xff0c;容纳进去了面向对象编程思想&#xff0c;并增加了许多有用的库&#xff0c;以及编程范式等。熟悉C语言之后&#xff0c;对C学习有一定的帮助&#xff0c;因此从今天开始们将进入&#xff23;的学习。 &#x1f496; 博主CSDN主页:…

《动手学深度学习(PyTorch版)》笔记4.5

注&#xff1a;书中对代码的讲解并不详细&#xff0c;本文对很多细节做了详细注释。另外&#xff0c;书上的源代码是在Jupyter Notebook上运行的&#xff0c;较为分散&#xff0c;本文将代码集中起来&#xff0c;并加以完善&#xff0c;全部用vscode在python 3.9.18下测试通过。…

ES文档索引、查询、分片、文档评分和分析器技术原理

技术原理 索引文档 索引文档分为单个文档和多个文档。 单个文档 新建单个文档所需要的步骤顺序&#xff1a; 客户端向 Node 1 发送新建、索引或者删除请求。节点使用文档的 _id 确定文档属于分片 0 。请求会被转发到 Node 3&#xff0c;因为分片 0 的主分片目前被分配在 …

微信小程序(十七)自定义组件生命周期(根据状态栏自适配)

注释很详细&#xff0c;直接上代码 上一篇 新增内容&#xff1a; 1.获取手机状态栏的高度 2.验证attached可以修改数据 3.动态绑定样式数值 源码&#xff1a; myNav.js Component({lifetimes:{//相当于vue的created,因为无法更新数据被打入冷宫created(){},//相当于vue的mount…

【JS基础】事件对象event、环境对象this、事件的高级操作

文章目录 一、事件对象1.1 事件对象是什么&#xff1f;1.2 使用方法 二、环境对象this以及回调函数2.1 它是什么&#xff1f;2.2 演示示例 三、事件的高级操作3.1 事件流3.2 事件捕获3.3 事件冒泡以及阻止冒泡3.4 事件解绑3.5 mouseover和mouseenter事件的区别3.6 事件委托它是…

HTML新手教程

HTML入门 教程&#xff1a;【狂神说Java】HTML5完整教学通俗易懂_哔哩哔哩_bilibili 一.初识HTML HyperTextMarkupLanguage&#xff08;超文本标记语言&#xff09; 超文本包括&#xff1a;文字、图片、音频、视频、动画。 HTML5的优势 世界知名浏览器厂商对HTML5的支持市场的…