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