function setupMouseoverContainer (svg, args) {
svg.select('.mg-active-datapoint').remove()
const textAnchor = args.mouseover_align === 'right'
? 'end'
: (args.mouseover_align === 'left'
? 'start'
: 'middle')
const mouseoverX = (args.mouseover_align === 'right')
? getPlotRight(args)
: (args.mouseover_align === 'left'
? getPlotLeft(args)
: (args.width - args.left - args.right) / 2 + args.left)
const activeDatapoint = svg.select('.mg-active-datapoint-container')
.attr('transform', 'translate(0 -18)')
.append('text')
.attr('class', 'mg-active-datapoint')
.attr('xml:space', 'preserve')
.attr('text-anchor', textAnchor)
let activeDatapointYNudge = 0.75
const yPosition = (args.xAxis_position === 'bottom')
? args.top * activeDatapointYNudge
: getBottom(args) + args.buffer * 3
if (args.markers) {
let yPos
svg.selectAll('.mg-marker-text')
.each(function () {
if (!yPos) {
yPos = select(this).attr('y')
} else if (yPos !== select(this).attr('y')) {
activeDatapointYNudge = 0.56
}
})
}
activeDatapoint
.attr('transform', 'translate(' + mouseoverX + ',' + (yPosition) + ')')
}