How to use the victory-core.Helpers.getPolarOrigin 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
y: props.polar ? Helpers.getPolarRange(props, "y") : Helpers.getRange(props, "y")
    };
    const baseScale = {
      x: Scale.getScaleFromProps(props, "x") ||
        axisComponents.x && axisComponents.x.type.getScale(axisComponents.x.props) ||
        Scale.getDefaultScale(),
      y: Scale.getScaleFromProps(props, "y") ||
        axisComponents.y && axisComponents.y.type.getScale(axisComponents.y.props) ||
        Scale.getDefaultScale()
    };
    const scale = {
      x: baseScale.x.domain(domain.x).range(range.x),
      y: baseScale.y.domain(domain.y).range(range.y)
    };

    const origin = props.polar ? Helpers.getPolarOrigin(props) : Axis.getOrigin(domain);

    const originSign = {
      x: Axis.getOriginSign(origin.x, domain.x),
      y: Axis.getOriginSign(origin.y, domain.y)
    };

    // 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)
    };
github FormidableLabs / victory / packages / victory-scatter / src / helper-methods.js View on Github external
x: Helpers.getRange(props, "x"),
    y: Helpers.getRange(props, "y")
  };
  const domain = {
    x: Domain.getDomain(props, "x"),
    y: Domain.getDomain(props, "y")
  };
  const scale = {
    x: Scale.getBaseScale(props, "x")
      .domain(domain.x)
      .range(props.horizontal ? range.y : range.x),
    y: Scale.getBaseScale(props, "y")
      .domain(domain.y)
      .range(props.horizontal ? range.x: range.y)
  };
  const origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
  const z = props.bubbleProperty || "z";
  return { domain, data, scale, style, origin, z };
};
github FormidableLabs / victory / packages / victory-bar / src / helper-methods.js View on Github external
x: Helpers.getRange(props, "x"),
    y: Helpers.getRange(props, "y")
  };
  const domain = {
    x: Domain.getDomainWithZero(props, "x"),
    y: Domain.getDomainWithZero(props, "y")
  };
  const scale = {
    x: Scale.getBaseScale(props, "x")
      .domain(domain.x)
      .range(props.horizontal ? range.y : range.x),
    y: Scale.getBaseScale(props, "y")
      .domain(domain.y)
      .range(props.horizontal ? range.x: range.y)
  };
  const origin = polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
  return { style, data, scale, domain, origin };
};
github FormidableLabs / victory / packages / victory-polar-axis / src / victory-polar-axis.js View on Github external
renderGroup(props, children) {
    const { groupComponent } = props;
    const groupComponentProps = groupComponent.props || {};
    const origin = Helpers.getPolarOrigin(props);
    const transform = groupComponentProps.transform || `translate(${origin.x}, ${origin.y})`;
    return React.cloneElement(groupComponent, { transform }, children);
  }
github FormidableLabs / victory / packages / victory-polar-axis / src / victory-polar-axis.js View on Github external
renderGroup(props, children) {
    const { groupComponent } = props;
    const groupComponentProps = groupComponent.props || {};
    const origin = Helpers.getPolarOrigin(props);
    const transform = groupComponentProps.transform || `translate(${origin.x}, ${origin.y})`;
    return React.cloneElement(groupComponent, { transform }, children);
  }
github FormidableLabs / victory / packages / victory-area / src / helper-methods.js View on Github external
x: Helpers.getRange(props, "x"),
    y: Helpers.getRange(props, "y")
  };
  const domain = {
    x: Domain.getDomainWithZero(props, "x"),
    y: Domain.getDomainWithZero(props, "y")
  };
  const scale = {
    x: Scale.getBaseScale(props, "x")
      .domain(domain.x)
      .range(props.horizontal ? range.y : range.x),
    y: Scale.getBaseScale(props, "y")
      .domain(domain.y)
      .range(props.horizontal ? range.x: range.y)
  };
  const origin = polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
  const data = getDataWithBaseline(props, scale);
  return { style, data, scale, domain, origin };
};
github FormidableLabs / victory-chart / src / components / victory-group / victory-group.js View on Github external
};
    const baseScale = {
      x: Scale.getScaleFromProps(modifiedProps, "x") || Scale.getDefaultScale(),
      y: Scale.getScaleFromProps(modifiedProps, "y") || Scale.getDefaultScale()
    };
    const xScale = baseScale.x.domain(domain.x).range(range.x);
    const yScale = baseScale.y.domain(domain.y).range(range.y);
    const scale = {
      x: horizontal ? yScale : xScale,
      y: horizontal ? xScale : yScale
    };
    const categories = {
      x: Wrapper.getCategories(modifiedProps, "x"),
      y: Wrapper.getCategories(modifiedProps, "y")
    };
    const origin = polar ? props.origin : Helpers.getPolarOrigin(modifiedProps);
    const padding = Helpers.getPadding(props);
    return {
      datasets, categories, range, domain, horizontal,
      scale, style, colorScale, color, offset, origin, padding
    };
  }
github FormidableLabs / victory / packages / victory-errorbar / src / helper-methods.js View on Github external
x: Helpers.getRange(props, "x"),
    y: Helpers.getRange(props, "y")
  };
  const domain = {
    x: getDomain(props, "x"),
    y: getDomain(props, "y")
  };
  const scale = {
    x: Scale.getBaseScale(props, "x")
      .domain(domain.x)
      .range(props.horizontal ? range.y : range.x),
    y: Scale.getBaseScale(props, "y")
      .domain(domain.y)
      .range(props.horizontal ? range.x : range.y)
  };
  const origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
  return { domain, data, scale, style, origin };
};