lineOption.js 1.7 KB
/*
 * @Description: 
 * @Author: huyue
 * @Date: 2022-06-30 10:57:14
 * @LastEditors: huyue
 * @LastEditTime: 2022-06-30 10:57:17
 */
function getLineOptions(obj) {
    const { tooltipFormatter } = obj
    var lineOptions = {
      tooltip: {
        trigger: 'axis',
        borderWidth: 0,
        backgroundColor: 'rgba(68,68,68,0.80)',
        textStyle: {
          color: '#FFFFFF',
          fontSize: '8px'
        },
        extraCssText: 'width: 60px;',
        formatter: tooltipFormatter || ''
      },
      grid: {
        left: '3%',
        right: '4%',
        top: '10%',
        bottom: '10%',
        containLabel: true
      },
      xAxis: {
        type: 'category',
        axisLabel: {
          color: '#606266',
          fontSize: '0.8em'
        },
        data: []
      },
      yAxis: {
        type: 'value',
        splitLine: {
          lineStyle: {
            color: '#606266'
          }
        }
      },
      series: [
        {
          type: 'line',
          itemStyle: {
            color: '#F5AA01'
          },
  
          // 节点,平滑曲线
          symbol: 'none',
          smooth: true,
          // 折线背景色
          areaStyle: {
            color: {
              type: 'linear',
              x: 0,
              y: 0,
              x2: 0,
              y2: 1,
              colorStops: [
                {
                  offset: 0,
                  color: 'rgba(254, 84, 0, 0.6)'
                },
                {
                  offset: 1,
                  color: 'rgba(254, 84, 0, 0.05)'
                }
              ]
            }
          },
          data: []
        }
      ]
    }
    return lineOptions
  }
  
  export default getLineOptions