refactor: validate y
This commit is contained in:
parent
03f6436be4
commit
690a7f4467
@ -433,6 +433,8 @@ export function xLine(x, label, height, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function yMarker(y, label, width, options = {}) {
|
export function yMarker(y, label, width, options = {}) {
|
||||||
|
if (!isValidNumber(y)) y = 0;
|
||||||
|
|
||||||
if (!options.labelPos) options.labelPos = 'right';
|
if (!options.labelPos) options.labelPos = 'right';
|
||||||
let x = options.labelPos === 'left' ? LABEL_MARGIN
|
let x = options.labelPos === 'left' ? LABEL_MARGIN
|
||||||
: width - getStringWidth(label, 5) - LABEL_MARGIN;
|
: width - getStringWidth(label, 5) - LABEL_MARGIN;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user