import { defineComponent as b, ref as v, computed as y, watch as B, onMounted as H, createElementBlock as c, openBlock as m, normalizeClass as g, createCommentVNode as k, createElementVNode as C, toDisplayString as L } from "vue";
import { createHistogramFromBins as x, createHistogramLog as w, createHistogramLinear as A } from "./histogram.js";
const V = /* @__PURE__ */ b({
  __name: "PlChartHistogram",
  props: {
    settings: {}
  },
  setup(n) {
    const e = n, o = v(), i = y(() => {
      const { xAxisLabel: t, yAxisLabel: a, threshold: u, compact: l, totalWidth: h = 674, totalHeight: p = 252 } = e.settings, s = l ? { top: 0, right: 0, bottom: 0, left: 0 } : { top: 0, right: 30, bottom: 40, left: 85 }, f = h - s.left - s.right, d = p - s.top - s.bottom;
      return {
        width: f,
        height: d,
        margin: s,
        compact: l,
        nBins: "nBins" in e.settings ? e.settings.nBins : 10,
        xAxisLabel: t,
        yAxisLabel: a,
        threshold: u
      };
    }), r = () => {
      const t = e.settings;
      if (t.type === "log-bins") {
        x(o.value, i.value, t.bins);
        return;
      }
      t.log ? w(o.value, i.value, t.numbers) : A(o.value, i.value, t.numbers);
    };
    return B(e, r), H(r), (t, a) => (m(), c("div", {
      class: g(t.$style.component)
    }, [
      n.settings.title && !n.settings.compact ? (m(), c("div", {
        key: 0,
        class: g(t.$style.title)
      }, L(n.settings.title), 3)) : k("", !0),
      C("div", {
        ref_key: "chart",
        ref: o
      }, null, 512)
    ], 2));
  }
});
export {
  V as default
};
//# sourceMappingURL=PlChartHistogram.vue2.js.map
