From 2d5ae8219d7327129f9a437efc7279559c517185 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 24 Apr 2021 09:27:35 +0200 Subject: [PATCH] visualizer: remove `bars` and `dots` option; plot: fix `bars` option --- CHANGELOG.md | 5 +++-- src/client/widgets/graphs/plot.js | 11 ++++++----- src/client/widgets/graphs/visualizer.js | 5 ++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb064cff..04bcd1cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,9 @@ ## 1.9.2 - bug fixes - - visualizer: remove `bars` option - - project tree: clear filter input when loading a session + - visualizer: remove `bars` and `dots` option + - plot: fix `bars` option + - project tree: clear filter input when loading a session - widgets - image: add pre defined values for `size`, `position` and `repeat` properties diff --git a/src/client/widgets/graphs/plot.js b/src/client/widgets/graphs/plot.js index a308d508..70183607 100644 --- a/src/client/widgets/graphs/plot.js +++ b/src/client/widgets/graphs/plot.js @@ -24,7 +24,6 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, }, class_specific: { - pips: {type: 'boolean', value: true, help: 'Set to false to hide the scale'}, rangeX: {type: 'object', value: {min: 0, max: 1}, help: 'Defines the min and max values for the x axis'}, rangeY: {type: 'object', value: {min: 0, max:1}, help: 'Defines the min and max values for the y axis'}, origin: {type: 'number|boolean', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'}, @@ -202,21 +201,23 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte draw_bars() { - var barWidth = Math.round(this.width / this.value.length), + var padding = this.cssVars.padding, + barWidth = Math.round((this.width - padding * 2) / this.value.length), offset = Math.round((this.width - barWidth * this.value.length) / 2) - var origin = mapToScale(this.getProp('origin') !== false ? this.getProp('origin') : this.rangeY.min, [this.rangeY.min,this.rangeY.max],[this.height,0],0,this.getProp('logScaleY'),true) + + var origin = mapToScale(this.getProp('origin') !== false ? this.getProp('origin') : this.rangeY.min, [this.rangeY.min, this.rangeY.max],[this.height - padding, padding], 0, this.getProp('logScaleY'), true) this.ctx.beginPath() for (let i in this.value) { - var y = mapToScale(this.value[i].length ? this.value[i][1] : this.value[i],[this.rangeY.min,this.rangeY.max],[this.height-2*PXSCALE,2*PXSCALE],0,this.logScaleY,true) + var y = mapToScale(this.value[i].length ? this.value[i][1] : this.value[i], [this.rangeY.min, this.rangeY.max], [this.height - 2 * PXSCALE - padding, 2 * PXSCALE + padding], 0, this.logScaleY, true) this.ctx.rect(offset + i * barWidth, Math.min(y, origin), barWidth - PXSCALE, Math.abs(Math.min(y - origin))) } this.ctx.globalAlpha = 0.4 - this.ctx.fillStyle = this.colors.custom + this.ctx.fillStyle = this.cssVars.colorWidget this.ctx.fill() } diff --git a/src/client/widgets/graphs/visualizer.js b/src/client/widgets/graphs/visualizer.js index e86a0c62..8f30ea8a 100644 --- a/src/client/widgets/graphs/visualizer.js +++ b/src/client/widgets/graphs/visualizer.js @@ -19,9 +19,8 @@ class Visualizer extends StaticProperties(Plot, {rangeX: {min: '', max: ''}, dot interaction: null }, style: { - _separator_visualizer_style: 'Visualizer style', - pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'}, - bars: null + bars: null, + dots: null, }, class_specific: { duration: {type: 'number', value: 1, help: 'Defines visualization duration in seconds'},