plots: add pips option

This commit is contained in:
jean-emmanuel 2017-07-04 11:56:39 +02:00
parent 690a048f30
commit 4024f9d4d9
5 changed files with 26 additions and 18 deletions

View file

@ -94,29 +94,33 @@ module.exports = class _plots_base extends _canvas_base {
this.ctx.font = PXSCALE * 10 + 'px sans-serif'
this.ctx.fillStyle = this.colors.text
if (this.pips.x) {
if (this.getProp('pips')) {
this.ctx.textBaseline = "bottom"
this.ctx.textAlign = 'left'
this.ctx.fillText(this.pips.x.min,(this.pips.y?12:2)*PXSCALE,this.height)
this.ctx.textAlign = 'right'
this.ctx.fillText(this.pips.x.max,this.width-2*PXSCALE,this.height)
if (this.pips.x) {
}
this.ctx.textBaseline = "bottom"
this.ctx.textAlign = 'left'
this.ctx.fillText(this.pips.x.min,(this.pips.y?12:2)*PXSCALE,this.height)
this.ctx.textAlign = 'right'
this.ctx.fillText(this.pips.x.max,this.width-2*PXSCALE,this.height)
if (this.pips.y) {
}
this.ctx.save()
this.ctx.translate(0, this.height)
this.ctx.rotate(-Math.PI/2)
if (this.pips.y) {
this.ctx.textBaseline = "top"
this.ctx.textAlign = 'left'
this.ctx.fillText(this.pips.y.min,(this.pips.x?12:2)*PXSCALE,2*PXSCALE)
this.ctx.textAlign = 'right'
this.ctx.fillText(this.pips.y.max,this.height-2*PXSCALE,2*PXSCALE)
this.ctx.rotate(Math.PI/2)
this.ctx.restore()
this.ctx.save()
this.ctx.translate(0, this.height)
this.ctx.rotate(-Math.PI/2)
this.ctx.textBaseline = "top"
this.ctx.textAlign = 'left'
this.ctx.fillText(this.pips.y.min,(this.pips.x?12:2)*PXSCALE,2*PXSCALE)
this.ctx.textAlign = 'right'
this.ctx.fillText(this.pips.y.max,this.height-2*PXSCALE,2*PXSCALE)
this.ctx.rotate(Math.PI/2)
this.ctx.restore()
}
}

View file

@ -18,6 +18,7 @@ module.exports = class Eq extends _plots_base {
top:'auto',
width:'auto',
height:'auto',
pips:true,
color:'auto',
css:'',

View file

@ -17,6 +17,7 @@ module.exports = class Led extends _widgets_base {
top:'auto',
width:'auto',
height:'auto',
pips:true,
color:'auto',
css:'',

View file

@ -17,6 +17,7 @@ module.exports = class Plot extends _plots_base {
top:'auto',
width:'auto',
height:'auto',
pips:true,
color:'auto',
css:'',

View file

@ -17,6 +17,7 @@ module.exports = class Visualizer extends _plots_base {
top:'auto',
width:'auto',
height:'auto',
pips:true,
color:'auto',
css:'',