/**
 * 计量信息-图表-进场趋势分析
 */

import React from 'react';
import * as echarts from 'echarts';
import ReactEcharts from 'echarts-for-react';
import SubTitle from '../../../vm-sub-title';
import NoData from '../../../vm-nodata';

const ChartJcqs = () => {
    const data = ['1'];
    const xData = ['1', '2'];
    const values = [11, 12];
    const option = {
        color: ['#00FFE7'],
        tooltip: {
            trigger: 'axis',
        },
        legend: {
            itemWith: 6,
            itemHeight: 6,
            textStyle: {
                color: '#fff',
                fontSize: 12,
            },
            data: ['进厂量', '设计能力'],
        },
        grid: {
            left: '8%',
            right: '6%',
            bottom: 20,
        },
        xAxis: {
            type: 'category',
            boundaryGap: true,
            axisTick: {
                show: false,
            },
            axisLabel: {
                color: '#fff',
            },
            data: xData,
        },
        yAxis: {
            type: 'value',
            name: '吨',
            min: 0,
            nameTextStyle: {
                color: '#fff',
            },
            splitNumber: 5,
            axisLabel: {
                color: '#fff',
            },
            splitLine: {
                lineStyle: {
                    type: 'dashed',
                    color: 'rgba(151,151,151,0.28)',
                },
            },
        },
        series: [
            {
                name: '进厂量',
                type: 'line',
                data: values,
                areaStyle: {
                    color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
                        {
                            offset: 0,
                            color: 'rgba(0, 0, 0, 0.5)',
                        },
                        {
                            offset: 1,
                            color: '#00FFE7',
                        },
                    ]),
                },
                markLine: {
                    data: [
                        {
                            yAxis: 12,
                            lineStyle: {
                                normal: {
                                    color: '#FFE25D',
                                },
                            },
                            name: '空闲',
                        },
                    ],
                    lineStyle: {
                        color: '#FFE25D',
                    },
                },
            },
        ],
    };
    return (
        <>
            <SubTitle title="进场趋势分析" />
            <div className="metering-content-charts-chart">
                {data?.length > 0 ? (
                    <ReactEcharts
                        option={option}
                        notMerge
                        lazyUpdate
                        style={{ height: '100%', width: '100%' }}
                    />
                ) : (
                    <NoData />
                )}
            </div>
        </>
    );
};

export default ChartJcqs;
