import { useMemo } from 'react'
import ReactEcharts from 'echarts-for-react';
const LineCharts = () => {

  const option = useMemo(() => {
    const data: any = [100, 50, 60, 70, 50]
    const showXAis = true
    return {
      xAxis: {
        type: 'category',
        boundaryGap: false,
        show: showXAis,
        data: showXAis ? ['09:15', '09:15', '09:15', '09:15', '09:15'] : [],
        axisLabel: {
          color: '#CBEDFF',
          interval: 0 // 设置为0以显示所有坐标点  
        },
        axisLine: {
          show: false,
        },
      },
      yAxis: {
        type: 'value',
        show: false,
      },
      grid: {
        left: '5%',  // 左边距
        right: '5%', // 右边距
        top: '10%',   // 上边距
        bottom: '30%' // 下边距
      },
      series: [
        {
          data: data,
          symbol: "none",
          type: 'line',
          lineStyle: {
            color: "#57EFE5",
          },

          areaStyle: {
            // 区域填充样式。设置后显示成区域面积图。
            color: {
              type: 'linear',
              x: 0,
              y: 1,
              x2: 0,
              y2: 0.2,
              colorStops: [
                {
                  offset: 0,
                  color: 'rgba(87, 239, 229, 0)', // 0% 处的颜色
                },
  
                {
                  offset: 1,
                  color: 'rgba(87, 239, 229, 0.36)', // 100% 处的颜色
                },
              ],
              global: false, // 缺省为 false
            },
          },
        },
      ],
    }
  }, [])

  return (
    <ReactEcharts
      option={option} // option：图表配置项
      style={{ width: '400px', height: '100px', margin: '0 auto' }}
    />
  )
}

export default LineCharts