in src/dataLabel/dataLabelUtils.ts [201:245]
export function drawDefaultLabelsForDataPointChart(data: any[], context: Selection<any, any, any, any>, layout: dataLabelInterfaces.ILabelLayout,
viewport: powerbi.IViewport, isAnimator: boolean = false, animationDuration?: number, hasSelection?: boolean, hideCollidedLabels: boolean = true): Selection<any, any, any, any> {
// Hide and reposition labels that overlap
let dataLabelManager = new DataLabelManager();
let filteredData = dataLabelManager.hideCollidedLabels(viewport, data, layout, false, hideCollidedLabels);
let hasAnimation: boolean = isAnimator && !!animationDuration;
let selectedLabels: Selection<BaseType, any, BaseType, any> = selectLabels(filteredData, context, false, hasAnimation, animationDuration);
if (!selectedLabels) {
return;
}
if (hasAnimation) {
selectedLabels
.text((d: LabelEnabledDataPoint) => d.labeltext)
.transition("")
.duration(animationDuration)
// .style(layout.style as any)
.style("opacity", (hasSelection ? (d: SelectionDataPoint) => getFillOpacity(d.selected, false, hasSelection, false) : 1) as any)
.attr(
"x", (d: LabelEnabledDataPoint) => d.labelX
)
.attr(
"y", (d: LabelEnabledDataPoint) => d.labelY
);
layout && layout.style && Object.keys(layout.style).forEach(style => selectedLabels = selectedLabels.style(style, layout.style[style]));
}
else {
selectedLabels
.attr(
"x", (d: LabelEnabledDataPoint) => d.labelX
)
.attr(
"y", (d: LabelEnabledDataPoint) => d.labelY
)
.text((d: LabelEnabledDataPoint) => d.labeltext)
.style(layout.style as any);
layout && layout.style && Object.keys(layout.style).forEach(style => selectedLabels = selectedLabels.style(style, layout.style[style]));
}
return selectedLabels;
}