import { createSvgContainer as e } from "./createSvgContainer.js";
import { drawBins as t } from "./drawBins.js";
import { createGridlines as n } from "./createGridlines.js";
import { logspace as r } from "./logspace.js";
import { createLabels as i } from "./createLabels.js";
import { drawThreshold as a } from "./drawThreshold.js";
import { normalizeBins as o } from "./normalizeBins.js";
import { axisBottom as s, axisLeft as c } from "d3-axis";
import { bin as l, max as u, min as d } from "d3-array";
import { scaleLinear as f, scaleSymlog as p } from "d3-scale";
var m = (e, t) => e.append("g").style("font-size", "14px").style("font-weight", "500").attr("transform", `translate(0,${t})`), h = (e) => e.append("g").style("font-size", "14px").style("font-weight", "500"), g = (e, t) => f().domain([0, u(e, (e) => e.length)]).range([t, 0]);
function _(r, p, _) {
	let { width: v, height: y, nBins: b = 10 } = p, x = e(r, p), S = d(_), C = u(_), w = f().domain([S, C]).range([0, v]), T = o(l().domain(w.domain()).thresholds(w.ticks(b))(_)), E = g(T, y);
	n(x, p, {
		x: w,
		y: E
	}, (e) => e.ticks(6)), t(x, T, p, {
		x: w,
		y: E
	}), a(x, {
		x: w,
		y: E
	}, p), m(x, y).call(s(w).tickSize(0)), h(x).call(c(E).tickSize(0)), i(x, p);
}
function v(f, _, v) {
	let { width: y, height: b, nBins: x = 10 } = _, S = e(f, _), C = d(v), w = u(v), T = p().domain([C, w]).range([0, y]).nice(), E = o(l().domain(T.domain()).thresholds(((e) => {
		let t = [];
		for (let n = 0; n <= e; n++) t.push(Number(T.invert(n / e * y).toFixed(2)));
		return t;
	})(x))(v)), D = g(E, b), O = r(0, Math.ceil(Math.log10(w)), 6);
	n(S, _, {
		x: T,
		y: D
	}, (e) => e.tickValues(O)), t(S, E, _, {
		x: T,
		y: D
	}), a(S, {
		x: T,
		y: D
	}, _), m(S, b).call(s(T).tickValues(O).tickSize(0)), h(S).call(c(D).tickSize(0)), i(S, _);
}
function y(l, f, _) {
	let { width: v, height: y } = f, b = e(l, f), x = o(_), S = d(x, (e) => e.x0), C = u(x, (e) => e.x1), w = p().domain([S, C]).range([0, v]).nice(), T = g(x, y), E = r(0, Math.ceil(Math.log10(C)), 6);
	n(b, f, {
		x: w,
		y: T
	}, (e) => e.tickValues(E)), t(b, x, f, {
		x: w,
		y: T
	}), a(b, {
		x: w,
		y: T
	}, f), m(b, y).call(s(w).tickValues(E).tickSize(0)), h(b).call(c(T).tickSize(0)), i(b, f);
}
export { y as createHistogramFromBins, _ as createHistogramLinear, v as createHistogramLog };

//# sourceMappingURL=histogram.js.map