import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import config, { axis, options } from '../../config.js';
import assign from '../../utils/assign.js';
import { to } from '../../utils/tools.js';

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var def = assign({}, options, {
  $series: {
    type: 'line',
    smooth: true,
    encode: {
      y: 0
    },
    itemStyle: {
      opacity: 0
    },
    emphasis: {
      itemStyle: {
        opacity: 0.8
      }
    },
    markPoint: {
      symbolSize: 1,
      itemStyle: {
        normal: {
          color: 'transparent'
        }
      },
      label: {
        show: true,
        position: 'right',
        formatter: function formatter(p) {
          return "h=".concat(p.name);
        }
      }
    }
  },
  color: config.color,
  title: {
    show: false,
    text: '泄洪曲线图'
  },
  grid: {
    top: 60,
    bottom: 50,
    left: 80,
    right: 80
  },
  tooltip: {
    trigger: 'none',
    axisPointer: {
      type: 'none'
    },
    formatter: function formatter(p) {
      return ["<article class=\"tooltip\">", "<li>\u6C34\u4F4D\uFF1A".concat(to(p[0].axisValue), "\uFF08m\uFF09</li>")].concat(_toConsumableArray(p.map(function (e) {
        return "<li>".concat(e.marker, "h=").concat(e.seriesName, "\uFF1A").concat(to(e.value[e.encode.x[0]]), "\uFF08m\xB3/s\uFF09</li>");
      })), ["</article>"]).join('');
    }
  },
  legend: {
    show: true,
    top: 10
  },
  xAxis: _objectSpread(_objectSpread({}, axis), {}, {
    name: '流量（m³/s）',
    type: 'value',
    boundaryGap: false,
    axisLine: {
      onZero: false
    },
    nameLocation: 'middle',
    nameGap: 25,
    max: function max(v) {
      return v.max;
    },
    min: 0
  }),
  yAxis: _objectSpread(_objectSpread({}, axis), {}, {
    name: '水位（m）',
    type: 'value',
    axisPointer: {
      show: true
    },
    splitNumber: 10,
    min: function min(v) {
      return to(v.min - (v.max - v.min) * 0.1);
    },
    max: function max(v) {
      return to(v.max + (v.max - v.min) * 0.1);
    },
    nameTextStyle: {
      align: 'right'
    }
  })
});

export { def as default };
