visualizer: remove bars and dots option; plot: fix bars option

This commit is contained in:
jean-emmanuel 2021-04-24 09:27:35 +02:00
parent 1c3812bb05
commit 2d5ae8219d
3 changed files with 11 additions and 10 deletions

View file

@ -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

View file

@ -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()
}

View file

@ -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'},