修改画的图不对的问题
This commit is contained in:
parent
55c0bb3d52
commit
def08150df
|
|
@ -36,6 +36,7 @@
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
doDraw(canvasWidth){
|
doDraw(canvasWidth){
|
||||||
|
console.log(canvasWidth)
|
||||||
const colorArr = [
|
const colorArr = [
|
||||||
'#e933dd',
|
'#e933dd',
|
||||||
'#6452da',
|
'#6452da',
|
||||||
|
|
@ -49,7 +50,8 @@
|
||||||
let current = 0;
|
let current = 0;
|
||||||
let times = 0;
|
let times = 0;
|
||||||
// 计算出每个线条的宽度
|
// 计算出每个线条的宽度
|
||||||
const oneLineWidth = (this.dataList.length / canvasWidth).toFixed(2)
|
const oneLineWidth = (canvasWidth / this.dataList.length).toFixed(2)
|
||||||
|
console.log(oneLineWidth)
|
||||||
const ctx = uni.createCanvasContext(this.canvasId, this);
|
const ctx = uni.createCanvasContext(this.canvasId, this);
|
||||||
// 设置填充颜色为红色
|
// 设置填充颜色为红色
|
||||||
this.dataList.map((v,i) => {
|
this.dataList.map((v,i) => {
|
||||||
|
|
@ -59,6 +61,7 @@
|
||||||
ctx.setFillStyle(colorArr[parseInt(v)]);
|
ctx.setFillStyle(colorArr[parseInt(v)]);
|
||||||
// 绘制矩形
|
// 绘制矩形
|
||||||
ctx.fillRect((i * oneLineWidth).toFixed(2), heightArr[parseInt(v)],oneLineWidth, 20);
|
ctx.fillRect((i * oneLineWidth).toFixed(2), heightArr[parseInt(v)],oneLineWidth, 20);
|
||||||
|
console.log((i * oneLineWidth).toFixed(2))
|
||||||
// current = v;
|
// current = v;
|
||||||
// times = 1
|
// times = 1
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>智能终端</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>智能终端</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/watchapp/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/watchapp/static/js/chunk-vendors.a54e2e08.js></script><script src=/watchapp/static/js/index.514b951d.js></script></body></html>
|
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/watchapp/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/watchapp/static/js/chunk-vendors.a54e2e08.js></script><script src=/watchapp/static/js/index.b40f30a8.js></script></body></html>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue