plots: move var declare

This commit is contained in:
bordun 2020-04-17 12:16:56 +02:00
parent b6023529f1
commit 4e49b09a33

View file

@ -117,7 +117,7 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
padding = this.cssVars.padding + PXSCALE,
decimals = this.getProp('smooth') ? 1 : 0,
length = this.value.length,
x, y, i, previousValue
x, y, i, previousValue, nx, ny
for (i = 0; i < length; i++) {
@ -130,8 +130,9 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
continue
}
let nx = mapToScale(i, [0, this.value.length - 1], [padding, this.width - padding], decimals, this.logScaleX, true),
ny = mapToScale(this.value[i], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], decimals, this.logScaleY, true)
nx = mapToScale(i, [0, this.value.length - 1], [padding, this.width - padding], decimals, this.logScaleX, true)
ny = mapToScale(this.value[i], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], decimals, this.logScaleY, true)
if (x !== nx || y !== ny) {
points.push(nx)
points.push(ny)