欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > IT业 > uniapp 微信小程序使用图表

uniapp 微信小程序使用图表

2025/5/13 13:39:03 来源:https://blog.csdn.net/m0_67475286/article/details/147782649  浏览:    关键词:uniapp 微信小程序使用图表

使用的是秋云 ucharts 直接在hbuilder插件市场进行下载导入项目中,多端支持

下载地址秋云 ucharts echarts 高性能跨全端图表组件 - DCloud 插件市场

导入成功后这里就能看到导入的插件啦

导入项目后就可以直接在页面中通过组件使用了 不需要其余配置 使用简单

参考案例

<template><view class="content"><view class="chart-box"><qiun-data-charts type="column":opts="opts":chartData="chartData"/></view><view class="text-area"><text class="title">{{title}}</text></view></view>
</template><script>export default {data() {return {title: '秋云图表示例',chartData: {},opts: {color: ["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE"],padding: [15, 15, 0, 5],legend: {show: true,position: "top",float: "center"},xAxis: {disableGrid: true},yAxis: {data: [{min: 0}]},extra: {column: {type: "group",width: 30,activeBgColor: "#000000",activeBgOpacity: 0.08}}}}},onLoad() {this.getServerData();},methods: {getServerData() {// 模拟数据let res = {categories: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],series: [{name: "销量",data: [35, 8, 25, 37, 4, 20, 30]},{name: "访问量",data: [70, 40, 65, 100, 44, 68, 90]}]};this.chartData = {categories: res.categories,series: res.series};}}}
</script><style>.content {display: flex;flex-direction: column;align-items: center;justify-content: center;}.chart-box {width: 100%;height: 500rpx;margin-top: 50rpx;}.text-area {display: flex;justify-content: center;margin-top: 30rpx;}.title {font-size: 36rpx;color: #8f8f94;}
</style>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词