import { color } from "echarts";

//折线图 
export const line = {
    legend: {
        right: 100,
        formatter: function (name) {
            return name;
        },
    },
    tooltip: {
        trigger: "axis",
        textStyle: {
            align: "left",
        },
        animation: false,
        // formatter: function (params) {
        //     var res = params[0].axisValueLabel;

        //     for (let i = 0; i <= params.length - 1; i++) {
        //         res += `</br>${params[i].marker} <span style="font-weight: bold">${params[i].value[1]}</span> ${params[i].seriesName}`;
        //     }
        //     return res;
        // },
        axisPointer: {
            animation: false,
            snap: true,
            label: {
                precision: 2, //坐标轴保留的位数
            },
            type: "cross", //cross shadow
            crossStyle: {
                //十字轴横线
                // opacity: "0",
                width: 0.5,
            },
            lineStyle: {
                // opacity: 0,
            },
        },
    },

    xAxis: {
        // type: "time",
        boundaryGap: false,
       
        axisTick: {
            //去除刻度
            show: false,
        },
        axisLine: {
            //去除轴线
            show: false,
        },
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: [
        {
            position: "left",
            type: "value",
            // min: `dataMin`,
            // max: `dataMax`,
            // axisLabel: {
            //     formatter: function (value) {
            //         let data
            //         if (value > 10000000) {
            //             data = `${(value / 10000000)} KW`
            //         } else if (value > 1000000) {
            //             data = `${(value / 1000000)} M`
            //         } else if (value / 10000) {
            //             data = `${(value / 10000)} W`
            //         }
            //         return data
            //     }
            // }
        },
        {
            position: "right",
            // type: "log",
            splitNumber: "5",
            show: true,
        },
        {
            position: "right",
            // type: "log",
            splitNumber: "5",
            show: false,
        },
        {
            position: "right",
            // type: "log",
            splitNumber: "5",
            show: false,
        },
    ],
    dataZoom: [
        {
            type: "inside",
            start: 10,
            end: 100,
            maxSpan: 100,
            minSpan: 2,
            animation: false,
        },
        {
            type: "inside",//slider
            start: 10,
            end: 100,
            // showDetail: false,
        },
    ],
    series: [
        {
            name: "line",
            type: "line",
            smooth: false, //线条是否圆滑
            symbol: "circle",
            symbolSize: 5,
            showSymbol: false,
            itemStyle: {
                color: "#5721E4",
                borderColor: "rgba(221,220,107,0.1)",
                borderWidth: 12,
            },
            lineStyle: {
                //线条样式
                color: "#5721E4",
                width: "2",
            },
            data: [150, 230, 224, 218, 135, 147, 260],
        },
      
       

    ],
}
//柱状图
export const bar ={
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        axisTick: {
          alignWithLabel: true
        }
      }
    ],
    yAxis: [
      {
        type: 'value',
        show:true

      }
    ],
    series: [
      {
        name: 'Direct',
        type: 'bar',
        barWidth: '60%',
        data: [10, 52, 200, 334, 390, 330, 220],
        itemStyle:{
            borderRadius:[100,100,0,0],
            color:"#7645EE",
        }
      }
    ]
  }