import { echartOptionProfixHandle } from "../../../../../../../packages/public/chart.mjs";
import "../../../../../../../packages/public/publicConfig.mjs";
const includes = ["legend", "xAxis", "yAxis", "grid"];
const seriesHandle = (color) => {
  const numHandle = (numsi, i) => parseInt(`${numsi * Math.random()}`, 10) * 2;
  const nums = [260, 251, 200, 334, 366, 256, 253];
  return color.map((item, index) => ({
    name: `data${index + 1}`,
    type: "bar",
    data: nums.map((numsItem, numsi) => numHandle(numsItem))
  }));
};
const option = (color) => {
  return echartOptionProfixHandle(
    {
      tooltip: {
        trigger: "axis",
        showContent: false,
        axisPointer: {
          type: "shadow"
        }
      },
      grid: {
        left: "3%",
        right: "4%",
        bottom: "3%",
        containLabel: true
      },
      xAxis: {
        type: "category",
        data: color.map((e, i) => `data${i + 1}`),
        axisTick: {
          alignWithLabel: true
        }
      },
      yAxis: {
        show: true,
        type: "value"
      },
      series: seriesHandle(color || [])
    },
    includes
  );
};
export {
  includes,
  option
};
