import { flatten, max } from 'lodash';
import { VmLineCharts, VmWrapper } from "../../../_components";
import useSettings from "../../../_hooks/useSettings";
import { BaseService } from "../../api";
import { jsx as _jsx } from "react/jsx-runtime";
export default function Jcqsfx(props) {
  var _trendRes$values, _trendRes$values2;
  var _useSettings = useSettings(),
    isDark = _useSettings.isDark,
    chartFontColor = _useSettings.chartFontColor;
  var code = props.code,
    startDate = props.startDate,
    endDate = props.endDate;
  var _BaseService$useTrend = BaseService.useTrendInfo(code, startDate, endDate),
    trendRes = _BaseService$useTrend.trendRes;
  var maxNum = null;
  if ((trendRes === null || trendRes === void 0 || (_trendRes$values = trendRes.values) === null || _trendRes$values === void 0 ? void 0 : _trendRes$values.length) > 0) {
    maxNum = max(flatten(trendRes.values));
  }
  return /*#__PURE__*/_jsx("div", {
    className: "base-top--jcqsfx",
    children: /*#__PURE__*/_jsx(VmWrapper, {
      title: "\u8FDB\u573A\u8D8B\u52BF\u5206\u6790",
      needChange: false,
      children: /*#__PURE__*/_jsx(VmLineCharts, {
        unit: "\u5428",
        height: 240,
        showLegend: false,
        xAxis: (trendRes === null || trendRes === void 0 ? void 0 : trendRes.names) || [],
        yMax: maxNum,
        dataList: [{
          data: ((_trendRes$values2 = trendRes.values) === null || _trendRes$values2 === void 0 ? void 0 : _trendRes$values2[0]) || [],
          name: '进场量',
          markLine: {
            data: [{
              yAxis: trendRes !== null && trendRes !== void 0 && trendRes.values && trendRes.values[1] ? trendRes.values[1][0] : 0,
              lineStyle: {
                normal: {
                  color: '#FFE25D'
                }
              },
              name: '设计能力(吨/日)'
            }],
            lineStyle: {
              color: '#52C41A'
            },
            label: {
              show: true,
              position: 'insideEndTop',
              formatter: '{b}: {c}',
              color: isDark ? '#fff' : chartFontColor,
              fontWeight: 'normal'
            }
          }
        }]
      })
    })
  });
}