/** @type {string[]} */
const colors = []
series.forEach((item) => {
const val = item?.[0]?.[1]
if (val) {
colors.push(getRingColor(val))
}
})
上周五还是周六突然出现的问题,uniapp的小程序。
如果用这种形式就能显示。用渐变色就不能显示图表信息。
不能显示的是这个
color: { type: 'linearGradient', color: [ { p: 0, c: '#FF64B4' }, { p: 1, c: '#A94CFF' }, ],},
还有报错可以看看,ctx是canvas生成的。
TypeError: Cannot read property 'x' of undefined
at P (VM26693 ctx.js:70)
at Object.L [as getColor] (VM26693 ctx.js:81)
at VM26695 draw-bar.js:124
at Array.forEach ()
at VM26695 draw-bar.js:94
at Array.forEach ()
at _callee$ (VM26695 draw-bar.js:90)
at s (VM26651 regeneratorRuntime.js:1)
at Generator. (VM26651 regeneratorRuntime.js:1)
at Generator.next (VM26651 regeneratorRuntime.js:1)
渐变是0-1之间渐变吧,现在1没了,判断下如果只有一个的话改单颜色试试呢