How to use the victory-core.Helpers.getPadding 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-chart / src / components / victory-chart / victory-chart.js View on Github external
};

    // TODO: check
    const categories = {
      x: Wrapper.getCategories(props, "x", childComponents),
      y: Wrapper.getCategories(props, "y", childComponents)
    };

    const stringMap = {
      x: createStringMap(props, "x", childComponents),
      y: createStringMap(props, "y", childComponents)
    };

    const defaultDomainPadding = getDefaultDomainPadding(childComponents, horizontal);

    const padding = Helpers.getPadding(props);

    return {
      axisComponents, categories, domain, range, horizontal, scale, stringMap,
      style, origin, originSign, defaultDomainPadding, padding
    };
  }
github FormidableLabs / victory / packages / victory-scatter / src / helper-methods.js View on Github external
const getMaxRadius = () => {
    const minPadding = Math.min(...values(Helpers.getPadding(props)));
    return Math.max(minPadding, 5); // eslint-disable-line no-magic-numbers
  };
  const maxRadius = maxBubbleSize || getMaxRadius();
github FormidableLabs / victory-chart / src / components / victory-axis / helper-methods.js View on Github external
getCalculatedValues(props, fallbackProps) {
    const defaultStyles = props.theme && props.theme.axis ? props.theme.axis : fallbackProps.style;
    const style = this.getStyles(props, defaultStyles);
    const padding = Helpers.getPadding(props);
    const orientation = props.orientation || (props.dependentAxis ? "left" : "bottom");
    const isVertical = Axis.isVertical(props);
    const labelPadding = this.getLabelPadding(props, style);
    const stringTicks = Axis.stringTicks(props);
    const scale = this.getScale(props);
    const ticks = this.getTicks(props, scale);
    const tickFormat = this.getTickFormat(props, scale, ticks);
    const anchors = this.getAnchors(orientation, isVertical);

    return {
      style, padding, orientation, isVertical, labelPadding, stringTicks,
      anchors, scale, ticks, tickFormat
    };
  },
github FormidableLabs / victory / src / components / victory-polar-chart / victory-polar-chart.js View on Github external
getDefaultRadius(props) {
    const { left, right, top, bottom } = Helpers.getPadding(props);
    const { width, height } = props;
    return Math.min(width - left - right, height - top - bottom) / 2;
  }
github FormidableLabs / victory / packages / victory-pie / src / helper-methods.js View on Github external
const getCalculatedValues = (props) => {
  const { theme, colorScale } = props;
  const styleObject = theme && theme.pie && theme.pie.style ? theme.pie.style : {};
  const style = Helpers.getStyles(props.style, styleObject, "auto", "100%");
  const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
  const padding = Helpers.getPadding(props);
  const defaultRadius = getRadius(props, padding);
  const origin = getOrigin(props, padding);
  const data = Data.getData(props);
  const slices = getSlices(props, data);
  return assign({}, props, { style, colors, padding, defaultRadius, data, slices, origin });
};
github FormidableLabs / victory-chart / src / components / victory-group / victory-group.js View on Github external
getChildProps(props, calculatedProps) {
    const { categories, domain, scale, horizontal } = calculatedProps;
    return {
      height: props.height,
      width: props.width,
      padding: Helpers.getPadding(props),
      standalone: false,
      theme: props.theme,
      categories,
      domain,
      scale,
      horizontal
    };
  }
github FormidableLabs / victory / src / components / victory-stack / victory-stack.jsx View on Github external
getChildProps(props, calculatedProps) {
    const { categories, domain, scale, horizontal } = calculatedProps;
    return {
      height: props.height,
      width: props.width,
      padding: Helpers.getPadding(props),
      standalone: false,
      categories,
      domain,
      scale,
      horizontal
    };
  }
github FormidableLabs / victory / packages / victory-group / src / helper-methods.js View on Github external
};
  const baseScale = {
    x: Scale.getScaleFromProps(props, "x") || Wrapper.getScale(props, "x"),
    y: Scale.getScaleFromProps(props, "y") || Wrapper.getScale(props, "y")
  };
  const scale = {
    x: baseScale.x
      .domain(domain.x)
      .range(props.horizontal ? range.y : range.x),
    y: baseScale.y
      .domain(domain.y)
      .range(props.horizontal ? range.x: range.y)
  };

  const origin = polar ? props.origin : Helpers.getPolarOrigin(props);
  const padding = Helpers.getPadding(props);
  return {
    datasets,
    categories,
    range,
    domain,
    horizontal,
    scale,
    style,
    colorScale,
    color,
    offset,
    origin,
    padding
  };
}