packages/victory-core/src/victory-util/domain.js
function getDomainFromData(props, axis, dataset) {
  dataset = dataset || Data.getData(props);
  const { polar, startAngle = 0, endAngle = 360 } = props;
  const minDomain = getMinFromProps(props, axis);
  const maxDomain = getMaxFromProps(props, axis);
  if (dataset.length < 1) {
    return minDomain !== undefined && maxDomain !== undefined
      ? getDomainFromMinMax(minDomain, maxDomain)
      : undefined;
  }
  const min = minDomain !== undefined ? minDomain : getExtremeFromData(dataset, axis, "min");
  const max = maxDomain !== undefined ? maxDomain : getExtremeFromData(dataset, axis, "max");
  const domain = getDomainFromMinMax(min, max);
  return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360
    ? getSymmetricDomain(domain, getFlatData(dataset, axis))
    : domain;
}
function getDomainFromData(props, axis, dataset) {
  dataset = dataset || Data.getData(props);
  const { polar, startAngle = 0, endAngle = 360 } = props;
  const minDomain = getMinFromProps(props, axis);
  const maxDomain = getMaxFromProps(props, axis);
  if (dataset.length < 1) {
    return minDomain !== undefined && maxDomain !== undefined
      ? getDomainFromMinMax(minDomain, maxDomain)
      : undefined;
  }
  const min = minDomain !== undefined ? minDomain : getExtremeFromData(dataset, axis, "min");
  const max = maxDomain !== undefined ? maxDomain : getExtremeFromData(dataset, axis, "max");
  const domain = getDomainFromMinMax(min, max);
  return polar && axis === "x" && Math.abs(startAngle - endAngle) === 360
    ? getSymmetricDomain(domain, getFlatData(dataset, axis))
    : domain;
}
function getDomainFromData ( props , axis , dataset ) { dataset = dataset || Data . getData ( props ) ; const { polar , startAngle = 0 , endAngle = 360 } = props ; const minDomain = getMinFromProps ( props , axis ) ; const maxDomain = getMaxFromProps ( props , axis ) ; if ( dataset . length < 1 ) { return minDomain !== undefined && maxDomain !== undefined ? getDomainFromMinMax ( minDomain , maxDomain ) : undefined ; } const min = minDomain !== undefined ? minDomain : getExtremeFromData ( dataset , axis , "min" ) ; const max = maxDomain !== undefined ? maxDomain : getExtremeFromData ( dataset , axis , "max" ) ; const domain = getDomainFromMinMax ( min , max ) ; return polar && axis === "x" && Math . abs ( startAngle - endAngle ) === 360 ? getSymmetricDomain ( domain , getFlatData ( dataset , axis ) ) : domain ; }
Returns a domain from a dataset for a given axis
@param {Object} props: the props object
@param {String} axis: the current axis
@param {Array} dataset: an array of data
@returns {Array} the domain based on data
Returns a domain from a dataset for a given axis