Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
const tooltipTextSize = TextSize.approximateTextSize(tooltipText(datum), tooltipStyle);
const labelStyle = _.assign({}, style, {
pointerEvents: 'none',
});
const labelUnitsStyle = _.assign({}, labelStyle, {
fontSize: labelStyle.fontSize / 2,
baselineShift: -((labelStyle.fontSize / 2) * 0.25),
fill: colors.statDefault,
});
const labelText = text(datum);
const labelUnitsTextSize = TextSize.approximateTextSize(labelText[1] || '', labelUnitsStyle);
// Ensure that the datum y value isn't below zero, or the tooltip will be incorrectly positioned
const tooltipDatum = {
...datum,
y: _.max([datum.y, 0]),
};
return (
text,
tooltipText,
} = props;
const tooltipFontSize = _.min([barWidth / 2, 12]);
const tooltipHeight = tooltipFontSize * 1.2;
const tooltipRadius = tooltipHeight / 2;
const disabled = isDisabled();
const tooltipStyle = _.assign({}, style, {
fontSize: tooltipFontSize,
display: disabled ? 'none' : 'inherit',
});
const tooltipTextSize = TextSize.approximateTextSize(tooltipText(datum), tooltipStyle);
const labelStyle = _.assign({}, style, {
pointerEvents: 'none',
});
const labelUnitsStyle = _.assign({}, labelStyle, {
fontSize: labelStyle.fontSize / 2,
baselineShift: -((labelStyle.fontSize / 2) * 0.25),
fill: colors.statDefault,
});
const labelText = text(datum);
const labelUnitsTextSize = TextSize.approximateTextSize(labelText[1] || '', labelUnitsStyle);
// Ensure that the datum y value isn't below zero, or the tooltip will be incorrectly positioned
const tooltipDatum = {