import { defineComponent, computed, watch, openBlock, createBlock, unref, normalizeStyle } from "vue";
import EchartsContainer from "../../../NComponents/echartsContainer/EchartsContainer.mjs";
const __default__ = defineComponent({ name: "EPieCommon" });
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    themeColor: {
      type: Object,
      required: false
    },
    themeSetting: {
      type: Object,
      required: false
    },
    chartConfig: {
      type: Object,
      required: true
    }
  },
  setup(__props) {
    const props = __props;
    const option = computed(() => {
      return props.chartConfig.option;
    });
    const style = computed(() => {
      return {
        height: props.chartConfig.attr.h,
        width: props.chartConfig.attr.w
      };
    });
    watch(
      () => props.chartConfig.option.type,
      (newData) => {
        try {
          if (newData === "nomal") {
            props.chartConfig.option.series[0].radius = "70%";
            props.chartConfig.option.series[0].roseType = false;
          } else if (newData === "ring") {
            props.chartConfig.option.series[0].radius = ["40%", "65%"];
            props.chartConfig.option.series[0].roseType = false;
          } else {
            props.chartConfig.option.series[0].radius = "70%";
            props.chartConfig.option.series[0].roseType = true;
          }
        } catch (error) {
          console.log(error);
        }
      },
      { deep: false, immediate: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createBlock(EchartsContainer, {
        options: unref(option),
        style: normalizeStyle(unref(style)),
        theme: __props.themeColor
      }, null, 8, ["options", "style", "theme"]);
    };
  }
});
export { _sfc_main as default };
