feat: allow setting lineType for yMarker

This commit is contained in:
Shivam Mishra 2021-02-22 03:18:14 +00:00 committed by GitHub
parent 067f5ea7f8
commit d8984ec5ae
2 changed files with 2 additions and 1 deletions

View File

@ -187,7 +187,7 @@ let componentConfigs = {
makeElements(data) {
return data.map(m =>
yMarker(m.position, m.label, this.constants.width,
{ labelPos: m.options.labelPos, stroke: m.options.stroke, mode: 'span', lineType: 'dashed' })
{ labelPos: m.options.labelPos, stroke: m.options.stroke, mode: 'span', lineType: m.options.lineType })
);
},
animateElements(newData) {

View File

@ -433,6 +433,7 @@ export function yMarker(y, label, width, options = {}) {
if (!isValidNumber(y)) y = 0;
if (!options.labelPos) options.labelPos = 'right';
if (!options.lineType) options.lineType = 'dashed';
let x = options.labelPos === 'left' ? LABEL_MARGIN
: width - getStringWidth(label, 5) - LABEL_MARGIN;