How to use the victory-core.Collection.getMinValue function in victory-core

To help you get started, we’ve selected a few victory-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FormidableLabs / victory / packages / victory-brush-line / src / victory-brush-line.js View on Github external
const withinBound = (value, bound) => {
  return value >= Collection.getMinValue(bound) && value <= Collection.getMaxValue(bound);
};
github FormidableLabs / victory-chart / src / helpers / wrapper.js View on Github external
const ensureZero = (domain) => {
      const isDependent = (axis === "y" && !horizontal) || (axis === "x" && horizontal);
      return isDependent ?
        [Collection.getMinValue(domain, 0), Collection.getMaxValue(domain, 0)] : domain;
    };
    const datasets = this.getDataFromChildren(props);
github FormidableLabs / victory / packages / victory-bar / src / helper-methods.js View on Github external
const getDefaultMin = (axis) => {
    const defaultZero = Scale.getType(props.scale[axis]) === "log"
      ? 1 / Number.MAX_SAFE_INTEGER
      : 0;
    let defaultMin = defaultZero;
    const minY = Collection.getMinValue(props.domain[axis]);
    const maxY = Collection.getMaxValue(props.domain[axis]);
    if (minY < 0 && maxY <= 0) {
      defaultMin = maxY;
    } else if (minY >= 0 && maxY > 0) {
      defaultMin = minY;
    }
    return datum[`_${axis}`] instanceof Date ? new Date(defaultMin) : defaultMin;
  };
  const _y0 = datum._y0 !== undefined ? datum._y0 : getDefaultMin("y");
github FormidableLabs / victory / src / components / containers / zoom-helper-methods.js View on Github external
scale: (currentDomain, originalDomain, factor) => {
    const [fromBound, toBound] = originalDomain;
    const [from, to] = currentDomain;
    const range = Math.abs(from - to);
    const midpoint = +from + (range / 2);
    const newRange = (range * factor) / 2;
    return [
      Collection.getMaxValue([midpoint - newRange, fromBound]),
      Collection.getMinValue([midpoint + newRange, toBound])
    ];
  },
github FormidableLabs / victory / src / components / victory-selection-container / helper-methods.js View on Github external
const makeBound = (a, b) => {
      return [ Collection.getMinValue([a, b]), Collection.getMaxValue([a, b]) ]
    };
github FormidableLabs / victory / packages / victory-area / src / helper-methods.js View on Github external
const getDefaultMin = (axis) => {
    const defaultZero = Scale.getType(scale[axis]) === "log"
      ? 1 / Number.MAX_SAFE_INTEGER
      : 0;
    const domain = scale[axis].domain();
    const minY = Collection.getMinValue(domain);
    const maxY = Collection.getMaxValue(domain);
    let defaultMin = defaultZero;
    if (minY < 0 && maxY <= 0) {
      defaultMin = maxY;
    } else if (minY >= 0 && maxY > 0) {
      defaultMin = minY;
    }
    return Collection.containsDates(domain) ? new Date(defaultMin) : defaultMin;
  }
github FormidableLabs / victory-chart / src / helpers / wrapper.js View on Github external
const childDomain = child.props && child.type.getDomain(sharedProps, currentAxis);
        if (childDomain) {
          const childDomainLength = childDomain.length;
          for (let index = 0; index < childDomainLength; index++) {
            childDomains[childDomainsLength++] = childDomain[index];
          }
        }
      } else if (child.props && child.props.children) {
        const newChildren = React.Children.toArray(child.props.children);
        const newChildrenLength = newChildren.length;
        for (let index = 0; index < newChildrenLength; index++) {
          children[childrenLength++] = newChildren[index];
        }
      }
    }
    const min = Collection.getMinValue(childDomains);
    const max = Collection.getMaxValue(childDomains);
    return childDomains.length === 0 ?
      [0, 1] : [min, max];
  },