feat: add trailingDot option
This commit is contained in:
parent
9c0ecc89be
commit
07597ebe87
@ -303,6 +303,8 @@ export default class AxisChart extends BaseChart {
|
|||||||
regionFill: this.lineOptions.regionFill,
|
regionFill: this.lineOptions.regionFill,
|
||||||
spline: this.lineOptions.spline,
|
spline: this.lineOptions.spline,
|
||||||
showDots: this.lineOptions.showDots,
|
showDots: this.lineOptions.showDots,
|
||||||
|
trailingDot: this.lineOptions.trailingDot,
|
||||||
|
hideDotBorder: this.lineOptions.hideDotBorder,
|
||||||
hideLine: this.lineOptions.hideLine,
|
hideLine: this.lineOptions.hideLine,
|
||||||
|
|
||||||
// same for all datasets
|
// same for all datasets
|
||||||
|
|||||||
@ -393,11 +393,27 @@ let componentConfigs = {
|
|||||||
data.radius,
|
data.radius,
|
||||||
c.color,
|
c.color,
|
||||||
(c.valuesOverPoints ? data.values[j] : ''),
|
(c.valuesOverPoints ? data.values[j] : ''),
|
||||||
j
|
j,
|
||||||
|
c.hideDotBorder
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c.trailingDot && !c.showDots) {
|
||||||
|
const lastIndex = data.yPositions.length - 1;
|
||||||
|
const dot = datasetDot(
|
||||||
|
data.xPositions[lastIndex],
|
||||||
|
data.yPositions[lastIndex],
|
||||||
|
data.radius,
|
||||||
|
c.color,
|
||||||
|
(c.valuesOverPoints ? data.values[lastIndex] : ''),
|
||||||
|
lastIndex,
|
||||||
|
c.hideDotBorder
|
||||||
|
);
|
||||||
|
|
||||||
|
this.units.push(dot);
|
||||||
|
}
|
||||||
|
|
||||||
return Object.values(this.paths).concat(this.units);
|
return Object.values(this.paths).concat(this.units);
|
||||||
},
|
},
|
||||||
animateElements(newData) {
|
animateElements(newData) {
|
||||||
|
|||||||
@ -573,9 +573,9 @@ export function datasetBar(x, yTop, width, color, label = '', index = 0, offset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function datasetDot(x, y, radius, color, label = '', index = 0) {
|
export function datasetDot(x, y, radius, color, label = '', index = 0, hideDotBorder = false) {
|
||||||
let dot = createSVG('circle', {
|
let dot = createSVG('circle', {
|
||||||
style: `fill: ${color}`,
|
style: `fill: ${color} ${hideDotBorder ? `stroke: ${color}`: ''}`,
|
||||||
'data-point-index': index,
|
'data-point-index': index,
|
||||||
cx: x,
|
cx: x,
|
||||||
cy: y,
|
cy: y,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user