src/js/util/scale-utils.js
function get_tick_widths(scaleOptions, font) {
	if (!scaleOptions) return { width: [], max: 0};

	var numTicks = scaleOptions.tickValues.length - 1;
	var formattedTicks = reduce(scaleOptions.tickValues, function(prev, tick, i) {
		if (i === numTicks) {
			return prev.concat([
				scaleOptions.prefix,
				help.roundToPrecision(tick, scaleOptions.precision),
				scaleOptions.suffix
			].join(""));
		} else {
			return prev.concat(help.roundToPrecision(tick, scaleOptions.precision));
		}
	}, []);

	var widths = map(formattedTicks, function(text) {
		return help.computeTextWidth(text, font);
	});

	return {
		widths: widths,
		max: d3.max(widths.slice(0, -1)) // ignore the top tick
	};
}
function get_tick_widths(scaleOptions, font) {
	if (!scaleOptions) return { width: [], max: 0};

	var numTicks = scaleOptions.tickValues.length - 1;
	var formattedTicks = reduce(scaleOptions.tickValues, function(prev, tick, i) {
		if (i === numTicks) {
			return prev.concat([
				scaleOptions.prefix,
				help.roundToPrecision(tick, scaleOptions.precision),
				scaleOptions.suffix
			].join(""));
		} else {
			return prev.concat(help.roundToPrecision(tick, scaleOptions.precision));
		}
	}, []);

	var widths = map(formattedTicks, function(text) {
		return help.computeTextWidth(text, font);
	});

	return {
		widths: widths,
		max: d3.max(widths.slice(0, -1)) // ignore the top tick
	};
}
get_tick_widths

@param scaleOptions object
@param font string
@returns {width: [number], max: number}