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

uCharts常用图表组件demo

带渐变阴影的曲线图
在这里插入图片描述

<view class="charts-box"><qiun-data-charts type="area" :opts="opts" :chartData="chartData" :ontouch="true":background="'rgba(256,256,256,0)'" />
</view>
data(){return{chartData: {},opts: {color: ["#F7DB4D"],padding: [20, 5, 4, 0],enableScroll: true,dataLabel: false,dataPointShape: false,disableScroll: true,fontColor: "#DCDCDC",legend: {show: false // 不绘制标题},xAxis: {disableGrid: true, // 不绘制纵向网格(即默认绘制网格)scrollShow: false, // 不显示滚动条itemCount: 4, // x轴显示数据个数fontColor: '#DCDCDC',axisLineColor: "#828282",gridColor: "#828282",},yAxis: {gridType: "dash", // 纵向网格线型,可选值:'solid'实线,'dash'虚线dashLength: 2, // 纵向网格为虚线时,单段虚线长度gridColor: "#828282",data: [{position: 'left', // 轴绘制到右侧fontColor: '#DCDCDC',axisLineColor: "#828282",}]},extra: {area: {type: "curve", // 曲线圆滑模式gradient: true, // 是否开启区域图渐变色},tooltip: {showBox: true,showArrow: false,gridType: 'dash',gridColor: '#F7DB4D'}}}}
}
onLoad(option) {this.getServerData();
},
methods: {getServerData(data, date) {//模拟从服务器获取数据时的延时setTimeout(() => {//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接let res = {categories: ["2018", "2019", "2020", "2021", "2022", "2023"],series: [{name: "曲线图",data: [55, 65, 62, 52, 59, 71]}]};this.chartData = JSON.parse(JSON.stringify(res));}, 500);},
}
.charts-box {position: relative;z-index: 2;width: 660rpx;height: 400rpx;margin: auto;
}

K线图

在这里插入图片描述

<view class="charts-box"><qiun-data-charts type="candle" :opts="opts" :chartData="chartData" :disableScroll="true" :ontouch="true":onzoom="true" />
</view>
data(){return{chartData: {},opts: {rotate: false,rotateLock: false,color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4","#ea7ccc"],padding: [15, 15, 0, 15],dataLabel: false,enableScroll: true,enableMarkLine: true,legend: {},xAxis: {labelCount: 4,itemCount: 40,disableGrid: true,gridColor: "#CCCCCC",gridType: "solid",dashLength: 4,scrollShow: true,scrollAlign: "left",scrollColor: "#A6A6A6",scrollBackgroundColor: "#EFEBEF"},yAxis: {},extra: {candle: {color: {upLine: "#f04864",upFill: "#f04864",downLine: "#2fc25b",downFill: "#2fc25b"},average: {show: true,name: ["MA5","MA10","MA30"],day: [5,10,20],color: ["#1890ff","#2fc25b","#facc14"]}},markLine: {type: "dash",dashLength: 5,data: [{value: 2150,lineColor: "#f04864",showLabel: true},{value: 2350,lineColor: "#f04864",showLabel: true}]},tooltip: {showCategory: true}}},}
}
onReady() {this.getServerData()
},
methods:{getServerData(date, data) {// 这里实际测试中,要向时间数据最后push4个空数据,防止时间出现堆在一起的情况date.push('')date.push('')date.push('')date.push('')//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接let res = {categories: ['2020-01-02','2020-01-03'], // dateseries: [{name: "上证指数",data: [ // data[1,2,3,4],[1,2,3,4],]}]};this.chartData = JSON.parse(JSON.stringify(res));},
}

进度条

在这里插入图片描述

<template><view class="charts-box"><qiun-data-charts type="arcbar" :opts="opts" :chartData="chartData" /></view>
</template>
<script>export default {data() {return {chartData: {},opts: {color: ["#F7DB4D"],padding: undefined,title: {name: "综合",fontSize: 20,color: "#fff"},subtitle: {name: "运势",fontSize: 20,color: "#fff"},extra: {arcbar: {type: "default",width: 12,backgroundColor: "#1C1C1C",startAngle: 0.75,endAngle: 0.25,gap: 2,linearType: "none"}}}}},onLoad(option) {this.getServerData();},methods: {getServerData() {//模拟从服务器获取数据时的延时setTimeout(() => {//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接let res = {series: [{name: "综合运势",color: "#F7DB4D",data: .9}]};this.chartData = JSON.parse(JSON.stringify(res));}, 500);},},}
</script>
http://www.lryc.cn/news/190103.html

相关文章:

  • VNC:Timed out waiting for a response from the computer
  • Kotlin 协程 知识点
  • 简单大方的自我介绍 PPT 格式
  • panads操作excel
  • 【MySQL】联合查询、子查询、合并查询
  • 小程序中如何设置所服务地区的时区
  • Linux环境安装mysql8.0
  • STM32_DMA_多通道采集ADC出现错位现象
  • Linux内存管理 (2):memblock 子系统的建立
  • 创新学习方式,电大搜题助您迈向成功之路
  • Mybatis整理
  • pytorch定义datase多次重复采样
  • 自动化测试 —— Pytest fixture及conftest详解!
  • Nginx解析漏洞
  • 【机器学习】决策树原理及scikit-learn使用
  • #基于一个小车项目的FREERTOS分析(一)系统时钟
  • ubuntu mmdetection配置
  • 嵌入式面试常见问题(一)
  • docker批量删除本地镜像
  • 数据结构(一)—— 数据结构简介
  • Ubuntu输入正确密码重新跳到登录界面
  • TCP/IP(十四)流量控制
  • CSS网页标题图案和LOGO SEO优化
  • 机器人制作开源方案 | 双轮提升搬运小车
  • 5G安卓核心板-MT6833/MT6853核心板规格参数
  • 信创之国产浪潮电脑+统信UOS操作系统体验4:visual studio code中怎么显示中文
  • Magica Cloth 使用方法笔记
  • c++ 学习之 强制类型转换运算符 const_cast
  • Ceph相关部署应用(博客)
  • 基于 ceph-deploy 部署 Ceph 集群 超详细