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

import * as echarts from 'echarts';
import { flatten, max } from 'lodash';
import { VmEmpty, VmLineCharts, VmWrapper } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { jsx as _jsx } from "react/jsx-runtime";
var ChartJcqs = function ChartJcqs(props) {
  var _props$values, _props$names;
  var _useSettings = useSettings(),
    chartFontColor = _useSettings.chartFontColor,
    theme = _useSettings.theme;
  var xData = (props === null || props === void 0 ? void 0 : props.names) || [];
  var values = props !== null && props !== void 0 && props.values ? props.values[0] : [];
  var maxNum = null;
  if ((props === null || props === void 0 || (_props$values = props.values) === null || _props$values === void 0 ? void 0 : _props$values.length) > 0) {
    maxNum = max(flatten(props.values));
  }
  return /*#__PURE__*/_jsx(VmWrapper, {
    title: "\u8FDB\u573A\u8D8B\u52BF\u5206\u6790",
    needChange: false,
    children: /*#__PURE__*/_jsx("div", {
      style: {
        height: 360
      },
      children: (props === null || props === void 0 || (_props$names = props.names) === null || _props$names === void 0 ? void 0 : _props$names.length) > 0 ? /*#__PURE__*/_jsx(VmLineCharts, {
        title: '进场量',
        height: 360,
        unit: "\u5428",
        yMax: maxNum,
        xAxis: xData,
        dataList: [{
          data: values,
          name: '进场量',
          areaStyle: {
            color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
              offset: 0,
              color: 'rgba(22, 119, 255, 0)'
            }, {
              offset: 0.5,
              color: 'rgba(22, 119, 255, 0.5)'
            }, {
              offset: 1,
              color: 'rgba(22, 119, 255, 1)'
            }])
          },
          markLine: {
            data: [{
              yAxis: props !== null && props !== void 0 && props.values ? props.values[1][0] : 0,
              lineStyle: {
                normal: {
                  color: '#F5222D'
                }
              },
              name: '设计能力(吨/日)'
            }],
            lineStyle: {
              color: '#F5222D'
            },
            label: {
              show: true,
              position: 'insideEndTop',
              formatter: '{b}: {c}',
              color: '#F5222D',
              fontWeight: 'normal'
            }
          }
        }]
      }) : /*#__PURE__*/_jsx(VmEmpty, {
        type: "NO_CHART"
      })
    })
  });
};
export default ChartJcqs;