当前位置: 首页 > news >正文

uniapp__微信小程序使用秋云ucharts折线图双轴

1、子组件

<template><view class="charts-box"><qiun-data-charts type="line":opts="computedOpts":chartData="chartData"/></view>
</template><script>
export default {props: {chartData: {type: Object,required: true},color: {type: Array,default: () => ["#1890FF", "#91CB74"]},yAxisMax: {type: Number,default: 5},yAxisMin: {type: Number,default: 0}},computed: {computedOpts() {// 在这里封装 opts,并根据父组件传入的 props 动态修改return {color: this.color, // 使用父组件传入的颜色padding: [15, 10, 0, 15],enableScroll: false,xAxis: {disableGrid: true,rotateLabel: true},yAxis: {data: [{type: "value",position: "left",},{type: "value",position: "right",min: this.yAxisMin, // 父组件传入的最小值max: this.yAxisMax  // 父组件传入的最大值}]},extra: {line: {type: "straight",width: 2,activeType: "hollow"},tooltip: {legendShape: "circle"}}};}}
};
</script><style scoped>
.charts-box {width: 715rpx;height: 300px;margin-left: -51rpx;
}
</style>

2、父组件

<lineecharts :chartData="chartData" :color="['#1890FF', '#91CB74']" :yAxisMax="10" :yAxisMin="0">getChartData() {const startTime = new Date();let timePoints = [];for (let i = 0; i < 6; i++) {const time = new Date(startTime.getTime() + i * 5000);const formattedTime = `${time.getHours()}:${time.getMinutes()}:${time.getSeconds()}`;timePoints.push(formattedTime);}setTimeout(() => {this.chartData = {categories: timePoints,series: [{name: "心率",data: [35, 8, 25, 37, 4, 20],index: 0},{name: "呼吸",data: [2, 4, 3, 1, 4, 1],index: 1}]};}, 100);},

 双轴series: [{
                                name: "心率",
                                data: [35, 8, 25, 37, 4, 20],
                                index: 0
                            },
                            {
                                name: "呼吸",
                                data: [2, 4, 3, 1, 4, 1],
                                index: 1
                            }
                        ]数据区分使用index

http://www.lryc.cn/news/459104.html

相关文章:

  • 云原生运维 - 旅程(简约版)
  • 2014年国赛高教杯数学建模B题创意平板折叠桌解题全过程文档及程序
  • PyCharm打开及配置现有工程(详细图解)
  • CSP-J
  • Linux系统:Linux中ln命令用法
  • 在SpringBoot+VUE中 实现登录-RSA的加密解密
  • 基于Android11简单分析audio_policy_configuration.xml
  • kafka-manager修改zookeeper端口号后启动仍然连接2181端口
  • RabbitMQ 入门(三)SpringAMQP
  • celery 项目中mysql 数据库连接数耗尽事故记录
  • Python数据分析-Scipy科学计算法
  • 【Python Django + Vue】酒店在线预订系统:用技术说话!
  • 禁用微软的windos安全中心
  • 2.html编辑器介绍
  • 树莓派应用--AI项目实战篇来啦-17.YOLOv8目标检测-安全帽检测
  • git-secret介绍
  • 【实战】Nginx+Lua脚本+Redis 实现自动封禁访问频率过高IP
  • 计算机专业大一课程:线性代数探秘
  • vscode写markdown插入图片视频并放在指定目录
  • 鸿蒙富文本显示
  • 手写mybatis之细化XML语句构建器,完善静态SQL解析
  • 使用Milvus和Llama-agents构建更强大的Agent系统
  • Python 工具库每日推荐【Arrow】
  • Win10 安装 Redis 数据库
  • 使用springboot生成war包
  • 见微知著:OpenEuler系统启动流程
  • 支持向量机-笔记
  • 研发线上事故风险解读之缓存篇
  • JavaScript前端开发技术
  • H.264 编码参数优化策略