in src/YAxisLabels.js [243:271]
static getLabels(props) {
const { tickCount, labelStyle, yScale } = defaults(
props,
{},
YAxisLabels.defaultProps,
);
const ticks = props.ticks || getScaleTicks(yScale, null, tickCount);
const style = {
labelStyle,
defaultStyle: YAxisLabels.defaultProps.labelStyle,
};
const scaleType = inferScaleType(yScale);
const propsFormats = props.format ? [props.format] : props.formats;
const formatStrs =
Array.isArray(propsFormats) && propsFormats.length
? propsFormats
: getDefaultFormats(scaleType);
const formats = makeLabelFormatters(formatStrs, scaleType);
// todo resolve ticks also
// if there are so many ticks that no combination of labels can fit on the axis,
// nudge down the tickCount and try again
// doing this will require communicating the updated ticks/tickCount back to the parent element...
const { labels } = resolveYLabelsForValues(yScale, ticks, formats, style);
// console.log('resolveYLabelsForValues took ', performance.now() - start);
// console.log('found labels', labels);
return labels;
}