const p = (e) => {
  let t = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  if (!t)
    return;
  let o = 100 * (t / 1920);
  return e * o;
};
function y(e, t, o, l, r, i, d, h) {
  var n = typeof e == "function" ? e.options : e;
  t && (n.render = t, n.staticRenderFns = o, n._compiled = !0), l && (n.functional = !0), i && (n._scopeId = "data-v-" + i);
  var a;
  if (d ? (a = function(s) {
    s = s || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !s && typeof __VUE_SSR_CONTEXT__ < "u" && (s = __VUE_SSR_CONTEXT__), r && r.call(this, s), s && s._registeredComponents && s._registeredComponents.add(d);
  }, n._ssrRegister = a) : r && (a = h ? function() {
    r.call(
      this,
      (n.functional ? this.parent : this).$root.$options.shadowRoot
    );
  } : r), a)
    if (n.functional) {
      n._injectStyles = a;
      var u = n.render;
      n.render = function(_, f) {
        return a.call(f), u(_, f);
      };
    } else {
      var c = n.beforeCreate;
      n.beforeCreate = c ? [].concat(c, a) : [a];
    }
  return {
    exports: e,
    options: n
  };
}
const g = {
  name: "yk-scatter-chart",
  props: {
    chartOption: {
      type: Array,
      default: () => []
    },
    width: {
      type: String,
      default: "100%"
    },
    height: {
      type: String,
      default: "100%"
    }
  },
  data() {
    return {
      option: {}
    };
  },
  mounted() {
    this.initOption();
  },
  methods: {
    scatterEchart(e) {
      const t = e.values.map((l) => ({
        name: l[4],
        icon: "rect"
      })), o = e.values.map((l, r) => ({
        name: t[r].name,
        data: [e.values[r]],
        type: "scatter",
        symbolSize: function(i) {
          return Math.sqrt(i[2]) / 30;
        },
        emphasis: {
          focus: "series",
          label: {
            show: !1,
            formatter: function(i) {
              return i.data[e.titleIndex] + ":" + i.data[2] + "\u5143";
            },
            position: "top"
          }
        }
      }));
      return this.scatterFormatter({ legendData: t, series: o, tabType: "business" });
    },
    scatterFormatter(e) {
      return console.log("//*", e), {
        color: [
          {
            type: "linear",
            x: 0,
            y: 0,
            x2: 1,
            y2: 0,
            colorStops: [
              {
                offset: 0,
                color: "rgba(224,104,15, 0.7)"
              },
              {
                offset: 1,
                color: "rgba(242,161,34, 0.7)"
              }
            ],
            opacity: 0.5,
            globalCoord: !1
          },
          {
            type: "linear",
            x: 0,
            y: 0,
            x2: 1,
            y2: 0,
            colorStops: [
              {
                offset: 0,
                color: "rgba(255,190,0,0.7)"
              },
              {
                offset: 1,
                color: "rgba(255,190,0,0.7)"
              }
            ],
            opacity: 0.5,
            globalCoord: !1
          },
          {
            type: "linear",
            x: 0,
            y: 0,
            x2: 1,
            y2: 0,
            colorStops: [
              {
                offset: 0,
                color: "rgba(77,212,155, 0.7)"
              },
              {
                offset: 1,
                color: "rgba(77,212,155, 0.7)"
              }
            ],
            opacity: 0.5,
            globalCoord: !1
          }
        ],
        title: {},
        legend: {
          right: "5%",
          top: "3%",
          itemHeight: p(0.144),
          itemWidth: p(0.144),
          textStyle: {
            color: "#575B62",
            fontWeight: "500",
            fontSize: p(0.14)
          },
          data: e.legendData
        },
        tooltip: {
          trigger: "item",
          formatter: function(t) {
            let o = e.tabType == "business" ? t.seriesName : t.data[3];
            if (!(o == "y" || o == "x\u8F74"))
              return t.marker + o + "</br>\u65E5\u5747\u9500\u552E\u989D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + (t.data[0] * 1e4).toFixed(2) + "\u5143</br>\u603B\u9500\u552E\u989D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + t.data[2] + `\u5143</br>\u65E5\u5747\u9500\u552E\u989D\u589E\u957F\u7387&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${t.data[1] < 0 ? "-" : ""}` + ((t.data[1] < 0 ? t.data[1] * -1 : t.data[1]) * 100).toFixed(2) + "%";
          }
        },
        grid: {
          left: "8%",
          top: "14%"
        },
        xAxis: {
          splitLine: {
            lineStyle: {
              type: "dashed"
            }
          },
          show: !1
        },
        yAxis: {
          show: !0,
          splitLine: {
            lineStyle: {
              type: "dashed"
            }
          }
        },
        series: [
          ...e.series,
          {
            name: "x\u8F74",
            type: "scatter",
            data: [[62e-4, 0]],
            itemStyle: {
              color: "rgba(255,255,255,0)",
              show: !1
            },
            cursor: "auto",
            markLine: {
              data: [
                {
                  type: "average",
                  name: "x\u8F74",
                  valueIndex: 0
                }
              ]
            }
          },
          {
            name: "y",
            type: "scatter",
            data: [[0, -1]],
            itemStyle: {
              color: "rgba(255,255,255,0)",
              show: !1
            },
            cursor: "auto",
            markLine: {
              data: [
                {
                  type: "average",
                  name: "six"
                }
              ],
              label: {
                show: !1
              }
            }
          }
        ]
      };
    },
    initOption() {
      this.option = this.scatterEchart({
        values: this.chartOption,
        lengendIndex: 4,
        titleIndex: 4
      });
    }
  }
};
var m = function() {
  var t = this, o = t._self._c;
  return o("div", { staticClass: "scatter-chart" }, [o("yk-base-chart", { style: { height: t.height, width: t.width }, attrs: { options: t.option } })], 1);
}, v = [], x = /* @__PURE__ */ y(
  g,
  m,
  v,
  !1,
  null,
  "9dc12867",
  null,
  null
);
const b = x.exports, S = {
  install(e) {
    e.component(b.name, b);
  }
};
export {
  S as default
};
