赞
踩
- const agePie = function (data) {
- const age = data;
- const query = wx.createSelectorQuery("");
- query.select("#agePie").fields({
- node: true,
- size: true
- });
- query.exec(function (res) {
- const canvas = res[0].node;
- // 定义颜色
- const color = ['#8B0000','#4169E1','#D2691E','#228B22','#4B0082','#FF1493','#FFD700',]
- const pie = canvas.getContext('2d');
- const dpr = wx.getSystemInfoSync().pixelRatio;
-
- canvas.width = res[0].width * dpr;
- canvas.height = res[0].height * dpr;
- // 中心点cp
- const cp = {
- x: canvas.width / 2,
- y: canvas.height / 2+150
- };
- // 定义 π
- const p = Math.PI;
- // 年龄区间
- var section = [];
- // 人数总和
- let all = 0;
- age.forEach((item) => {
- all +

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。