


const getCalendarHeatChart = (data) => {
  const option = {
    title: {
      top: 30,
      left: 'center',
      text: `日历热力图`,
      show: false
    },
    tooltip: {
      position: 'top',
      formatter: function (params) {
        const date = new Date(params.data[0]);
        return `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getDate().toString().padStart(2, '0')}<br/>数值: ${params.data[1]}`;
      }
    },
    visualMap: {
      show: false,
      min: 0,
      max: 500,
      calculable: true,
      orient: 'horizontal',
      left: 'center',
      top: 65,
      inRange: {
        color: ['#E7F3FF', '#8AC4FF', '#0A57A6', '#FFC069', '#CE4F51']
      },
      textStyle: {
        color: '#7f8c8d'
      }
    },
    calendar: {
      top: 24,
      left: 30,
      right: 30,
      cellSize: ['auto', 20],
      range: '2025',
      itemStyle: {
        borderWidth: 0.5,
        borderColor: '#ccc'
      },
      yearLabel: { show: true },
      monthLabel: {
        nameMap: 'cn'
      },
      dayLabel: {
        nameMap: ['日', '一', '二', '三', '四', '五', '六'],
        show: false
      }
    },
    series: {
      type: 'heatmap',
      coordinateSystem: 'calendar',
      data: data
    }
  };
  return option
}

export default getCalendarHeatChart