From c8c952fed702aebe3299364c9914f1c71a0ee87e Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 15 Sep 2017 18:16:57 +0200 Subject: [PATCH] plots: add `smooth` option (thanks to cardinal-spline-js) and make the line thicker --- package.json | 1 + .../js/app/widgets/plots/_plots_base.js | 37 ++++++++----------- src/browser/js/app/widgets/plots/eq.js | 1 + src/browser/js/app/widgets/plots/plot.js | 1 + .../js/app/widgets/plots/visualizer.js | 1 + src/browser/js/browser.js | 1 + 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 929c44e7..a260669a 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "babel-preset-es2015": "6.24.1", "babelify": "7.3.0", "browserify": "14.4.0", + "cardinal-spline-js": "^2.3.6", "electron": "1.8.0", "electron-packager": "9.0.1", "exorcist": "0.4.0", diff --git a/src/browser/js/app/widgets/plots/_plots_base.js b/src/browser/js/app/widgets/plots/_plots_base.js index ac261e88..c0904b5b 100644 --- a/src/browser/js/app/widgets/plots/_plots_base.js +++ b/src/browser/js/app/widgets/plots/_plots_base.js @@ -70,7 +70,8 @@ module.exports = class _plots_base extends _canvas_base { this.draw_data() - this.ctx.lineWidth = 1*PXSCALE + this.ctx.globalAlpha = 0.7 + this.ctx.lineWidth = 1.5 * PXSCALE this.ctx.strokeStyle = this.colors.custom this.ctx.stroke() @@ -86,11 +87,11 @@ module.exports = class _plots_base extends _canvas_base { this.ctx.lineTo(0,origin) this.ctx.closePath() this.ctx.fill() - this.ctx.globalAlpha = 1 } + this.ctx.globalAlpha = 1 this.ctx.font = PXSCALE * 10 + 'px sans-serif' this.ctx.fillStyle = this.colors.text @@ -128,36 +129,28 @@ module.exports = class _plots_base extends _canvas_base { draw_data() { - var first = true - var point = [] + var points = [] for (let i in this.data) { if (this.data[i][1]>this.rangeY.max || this.data[i][1]this.rangeX.max || this.data[i][0]