refactoring: plots ok

This commit is contained in:
jean-emmanuel 2018-08-30 10:13:57 +02:00
parent 1a644bae79
commit 4aa3dfa80e
5 changed files with 45 additions and 21 deletions

View file

@ -9,17 +9,26 @@ module.exports = class Plot extends _plots_base {
_plot:'plot',
rangeX: {min:0,max:1},
rangeY: {min:0,max:1},
origin: 'auto',
dots: true,
bars: false,
logScaleX: false,
logScaleY: false,
smooth: false,
pips:true,
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'},
logScaleX: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (log10)'},
logScaleY: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (log10)'},
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it.'},
dots: {type: 'boolean', value: true, help: ''},
bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'},
smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
}, ['target', 'precision', 'bypass'], {})
}, ['target', 'precision', 'bypass'], {
value: {type: 'array|string', help: [
'- `Array` of `y` values',
'- `Array` of `[x, y]` `array` values',
'- `String` `array`',
'- `String` `object` to update specific coordinates only: `{0:1, 4:0}` will change the 1st and 5th points\' coordinates',
]}
})
}

View file

@ -5,7 +5,15 @@ module.exports = class Rbgled extends Widget {
static defaults() {
return super.defaults({}, ['color', 'target', 'precision', 'bypass'], {})
return super.defaults({}, ['color', 'target', 'precision', 'bypass'], {
value: {type: 'array|string', help: [
'- `Array`: `[r, g, b]` (`r`, `g` and `b` between `0` and `255`)',
'- `Array`: `[r, g, b, alpha]` (`alpha` between `0` and `255`)',
'- `String`: CSS color',
]}
})
}

View file

@ -9,7 +9,11 @@ class Svg extends Widget {
_svg:'svg',
svg:'',
svg: {type: 'string', value: '', help: [
'Svg xml definition:',
'- will be wrapped in a `<svg></svg>` element',
'- `<path>` commands support a special percent notation (`%x` and `%y`)'
]}
}, ['color', 'target', 'precision', 'bypass'], {})

View file

@ -9,9 +9,12 @@ module.exports = class Text extends Widget {
_text: 'text',
vertical:false,
wrap:false,
align:'',
vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'},
wrap: {type: 'boolean', value: false, help: [
'Set to `true` to wrap long lines automatically.',
'This will not break overflowing words by default, word-breaking can be enabled by adding `word-break: break-all;` to the `css` property'},
]},
align: {type: 'string', value: '', help: 'Set to `left` or `right` to change text alignment (otherwise center)'},
}, ['color', 'target', 'precision', 'bypass'], {})

View file

@ -9,12 +9,12 @@ module.exports = class Visualizer extends _plots_base {
_visualizer:'visualizer',
duration:1,
range: {min:0,max:1},
origin: 'auto',
logScale: false,
smooth: false,
pips:true,
duration: {type: 'number', value: 1, help: 'Defines visualization duration in seconds'},
range: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it'},
logScale: {type: 'boolean', value: false, help: 'Set to `true` to use logarithmic scale for the y axis'},
smooth: {type: 'boolean|number', value: false, help: 'Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`)'},
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
}, ['target', 'precision', 'bypass'], {})