这个代码啥意思export default class LineChart extends Component<any> {
    pieRefs: any;
    
    myChart: any;
    
    state = {
        visible: false,
        infoStatus: []
    }
    
    handleClick = () => {
        this.setState((state: any) => ({
            visible: !state.visible,
        }));
    }
    
    closeModal = () => {
        this.setState({
            visible: false,
        });
    }
    
    componentDidMount(): void {
        this.loadChart(() => {
            const Window = window as any;
    
            this.myChart = Window.echarts.init(this.pieRefs);
            // this.myChart.on('click', (params: any) => {
            //     // this.getResultList(params);
            // });
            this.drawCanvas(this.props);
            // 监听表格自适应
            window.addEventListener('resize', this.bindResize);
        });
    }
    
    componentWillReceiveProps(nextProps: any): any {
        if (JSON.stringify(this.props.data) !== JSON.stringify(nextProps.data)) {
            setTimeout(() => this.drawCanvas(nextProps));
        }
    }
    
    componentWillUnmount(): void {
        window.removeEventListener('resize', this.bindResize);
    }
    
    drawCanvas = (props: any) => {
        const { data, lineLegend, lineCategory } = this.props;
        console.log(data);
    
    
    // 转换雷达图为折线图
    var series = [];
    const option = {
    title: {
        text: ''
    },
    tooltip: {
        trigger: 'item',
        formatter: function (params) {
            var index = params.dataIndex;
            var name = params.seriesName;
            var value = params.value;
            var sameRatio = params.seriesIndex < data.length ? data[params.seriesIndex].sameRatio[index] : '';
            var chainRatio = params.seriesIndex < data.length ? data[params.seriesIndex].chainRatio[index] : '';
            var tooltipHtml = '<div style="background-color:#000; padding:10px; width:160px">';
            tooltipHtml += '<div style="display: inline-block; margin-right: 16px;">' +
                '<div style="color:#fff; font-weight:bold; font-size:16px">' + name + '</div>' +
                '<div style="color:#fff; font-size:14px; margin-top:5px">当前值：' + value.toFixed(2) + '</div>' +
                '<div style="color:#fff; font-size:14px; margin-top:5px">月环比：' + chainRatio + '</div>' +
                '<div style="color:#fff; font-size:14px; margin-top:5px">年同比：' + sameRatio + '</div>' +
                '</div>';
            tooltipHtml += '</div>';
            return tooltipHtml;
        }
    },
    legend: {
        data: lineLegend
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        data: lineCategory
    },
    yAxis: {
        type: 'value'
    },
    series: series,
    };
    
    for (var i = 0; i < data.length; i++) {
    series.push({
        name: data[i].name,
        type: 'line',

        data: data[i].value,
        
    });
}
    
    
    
            
            
    
        if (!this.myChart) return '';
        this.myChart.setOption(option);
    }
    
    bindResize = () => {
        this.myChart.resize();
    }
    
    loadChart = (callBack: Function) => {
        if ((window as any).echarts) {
            if (callBack) {
                callBack();
            }
            return;
        }
        const script = document.createElement('script');
        script.src = 'https://s3plus.vip.sankuai.com/v1/mss_0f1209db61b048fa97009f13d1b4f911/camp-micro-ability-extension-flowchart/echars.js';
        script.onload = () => {
            if (callBack) {
                callBack();
            }
        };
        document.head.appendChild(script);
    }
    
    render(): JSX.Element {
        return (
            <>
                <div
                    id="e-charts"
                    style={{ height: '100%', width: '100%' }}
                    // eslint-disable-next-line no-return-assign
                    ref={(refs: any) => this.pieRefs = refs}
                />
            
            </>
            
        );
    }
}