Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getCalculatedProps(props, childComponents) {
const horizontal = childComponents.some((component) => component.props.horizontal);
const axisComponents = {
x: Axis.getAxisComponent(childComponents, "x"),
y: Axis.getAxisComponent(childComponents, "y")
};
const domain = {
x: ChartHelpers.getDomain(props, childComponents, "x"),
y: ChartHelpers.getDomain(props, childComponents, "y")
};
const range = {
x: Helpers.getRange(props, "x"),
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)
};
// TODO: check
const categories = {
const getCalculatedValues = (props) => {
const { theme, polar } = props;
const defaultStyles = theme && theme.area && theme.area.style ? theme.area.style : {};
const style = Helpers.getStyles(props.style, defaultStyles);
const range = {
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);
const getCalculatedValues = (props) => {
const { theme, polar } = props;
const defaultStyles = theme && theme.bar && theme.bar.style ? theme.bar.style : {};
const style = Helpers.getStyles(props.style, defaultStyles);
const data = Data.getData(props);
const range = {
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 };
const getCalculatedValues = (props) => {
const { theme, horizontal } = props;
const data = getData(props);
const range = {
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 defaultStyles = theme && theme.boxplot && theme.boxplot.style ? theme.boxplot.style : {};
const style = getStyles(props, defaultStyles);
const defaultOrientation = props.horizontal ? "top" : "right";
childComponents = childComponents || React.Children.toArray(props.children);
const role = "stack";
props = Helpers.modifyProps(props, fallbackProps, role);
const style = Wrapper.getStyle(props.theme, props.style, role);
const categories = Wrapper.getCategories(props, childComponents);
const datasets = stackData(props, childComponents);
const children = childComponents.map((c, i) => {
return React.cloneElement(c, { data: datasets[i] });
});
const domain = {
x: Wrapper.getDomain(assign({}, props, { categories }), "x", children),
y: Wrapper.getDomain(assign({}, props, { categories }), "y", children)
};
const range = {
x: Helpers.getRange(props, "x"),
y: Helpers.getRange(props, "y")
};
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 { colorScale, horizontal } = props;
return { datasets, categories, range, domain, horizontal, scale, style, colorScale, role };
}
getCalculatedProps(props, childComponents) {
const { role } = this.constructor;
const style = this.getStyle(props.theme, props.style, role);
const modifiedProps = Helpers.modifyProps(props, fallbackProps);
const { offset, colorScale, color, polar } = modifiedProps;
const horizontal = modifiedProps.horizontal || childComponents.every(
(component) => component.props && component.props.horizontal
);
const datasets = Wrapper.getDataFromChildren(modifiedProps);
const domain = {
x: Wrapper.getDomain(modifiedProps, "x", childComponents),
y: Wrapper.getDomain(modifiedProps, "y", childComponents)
};
const range = {
x: Helpers.getRange(modifiedProps, "x"),
y: Helpers.getRange(modifiedProps, "y")
};
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);
function getCalculatedProps(props, childComponents) {
const style = getStyles(props);
props = Helpers.modifyProps(props, fallbackProps, "chart");
const { horizontal, polar } = props;
const categories = Wrapper.getCategories(props, childComponents);
const stringMap = createStringMap(props, childComponents);
const domain = {
x: getDomain(assign({}, props, { categories }), "x", childComponents),
y: getDomain(assign({}, props, { categories }), "y", childComponents)
};
const range = {
x: Helpers.getRange(props, "x"),
y: Helpers.getRange(props, "y")
};
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(horizontal ? range.y : range.x),
y: baseScale.y.domain(domain.y).range(horizontal ? range.x : range.y)
};
const origin = polar ? Helpers.getPolarOrigin(props) : Axis.getOrigin(domain);
const originSign = {
x: Axis.getOriginSign(origin.x, domain.x),
y: Axis.getOriginSign(origin.y, domain.y)
};
getCalculatedProps(props, childComponents, style) {
const horizontal = props.horizontal || childComponents.every(
(component) => component.props.horizontal
);
const datasets = childComponents.map((child) => {
return child.type.getData(child.props) || Data.getData(child.props);
});
const domain = {
x: Wrapper.getStackedDomain(props, "x", datasets),
y: Wrapper.getStackedDomain(props, "y", datasets)
};
const range = {
x: Helpers.getRange(props, "x"),
y: Helpers.getRange(props, "y")
};
const baseScale = {
x: Scale.getScaleFromProps(props, "x") || Scale.getDefaultScale(),
y: Scale.getScaleFromProps(props, "y") || Scale.getDefaultScale()
};
const scale = {
x: baseScale.x.domain(domain.x).range(range.x),
y: baseScale.y.domain(domain.y).range(range.y)
};
const categories = {
x: Wrapper.getCategories(props, "x"),
y: Wrapper.getCategories(props, "y")
};
const colorScale = props.colorScale;
return {datasets, categories, range, domain, horizontal, scale, style, colorScale};
}
const getCalculatedValues = (props) => {
const defaultStyles =
props.theme && props.theme.scatter && props.theme.scatter.style
? props.theme.scatter.style
: {};
const style = Helpers.getStyles(props.style, defaultStyles);
const data = Data.getData(props);
const range = {
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";