<script setup lang="ts">
import * as echarts from 'echarts'

const props = defineProps<{
  echartsData: object
}>()

const chartRef = ref()
onMounted(() => {
  echarts.init(chartRef.value).setOption({
    // title: {
    //   text: '结对帮扶情况',
    //   textStyle: {
    //     color: '#fff',
    //   },
    // },
    tooltip: {
      trigger: 'item',
    },
    legend: {
      top: '1%',
      right: '5%',
      textStyle: {
        color: '#ccc',
      },
    },
    grid: {
      top: '8%',
      bottom: '80px',
    },
    color: ['#3E74FF', '#DC4F4E', '#3DB87B'],
    // dataset: {
    //   source: [
    //     ['date', '全景课堂', '资源包', '自由结对'],
    //     ['12-11', 15, 8, 11],
    //     ['12-11', 32, 18, 23],
    //     ['12-11', 45, 24, 33],
    //     ['12-11', 101, 67, 86],
    //     ['12-11', 122, 83, 64],
    //     ['12-11', 162, 95, 60],
    //     ['12-11', 201, 122, 147],
    //   ],
    // },
    xAxis: {
      type: 'category',
      // axisLabel: { interval: 0, rotate: -20 },
      axisLine: {
        show: true,
        lineStyle: {
          type: 'dashed',
          color: '#ccc',
        },
      },
      boundaryGap: false,
      data: props.echartsData.xAxis_data,
    },
    yAxis: {
      type: 'value',
      // interval: 10,
      axisLine: {
        show: true,
        lineStyle: {
          type: 'dashed',
          color: '#ccc',
        },
      },
      splitLine: {
        show: true,
        lineStyle: {
          type: 'dashed',
          color: '#ccc',
        },
      },
    },
    series: props.echartsData.series,

  })
})
</script>

<template>
  <div ref="chartRef" class="w-full h-full " />
</template>
