import React from 'react';
import echarts from 'echarts';
import ReactEcharts from 'echarts-for-react';
interface LcfxProps {
    data: Array<any>;
}

const Lcfx = (props: LcfxProps) => {
    const { data } = props;
    window.console.log(data);
    let option = {
        tooltip: {
            trigger: 'axis',
        },
        grid: {
            left: '5%',
            right: '5%',
            bottom: 20,
        },
        legend: {
            show: false,
        },
        xAxis: [
            {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],
                axisPointer: {
                    type: 'shadow',
                },
                axisTick: {
                    show: false,
                },
                axisLabel: {
                    color: '#fff',
                },
            },
        ],
        yAxis: [
            {
                type: 'value',
                name: '(次)',
                min: 0,
                interval: 100,
                nameTextStyle: {
                    color: '#fff',
                },
                splitNumber: 5,
                axisTick: {
                    show: false,
                },
                axisLabel: {
                    color: '#fff',
                },
                splitLine: {
                    lineStyle: {
                        type: 'dashed',
                        color: 'rgba(151,151,151,0.28)',
                    },
                },
            },
        ],
        series: [
            {
                name: '里程',
                type: 'bar',
                barWidth: 18,
                data: [20, 49, 70, 232, 256],
                itemStyle: {
                    color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                        {
                            offset: 0,
                            color: '#1677FF',
                        },
                        {
                            offset: 1,
                            color: '#62FDF3',
                        },
                    ]),
                },
            },
        ],
    };

    return (
        <ReactEcharts
            option={option}
            notMerge
            lazyUpdate
            style={{ height: '100%', width: '100%' }}
        />
    );
};

export default Lcfx;
