Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getBaseProps = (props, fallbackProps) => {
// eslint-disable-line max-statements
props = Helpers.modifyProps(props, fallbackProps, "candlestick");
const calculatedValues = getCalculatedValues(props);
const { data, style, scale, domain, origin, labelOrientation } = calculatedValues;
const {
groupComponent,
width,
height,
padding,
standalone,
name,
candleWidth,
candleRatio,
theme,
polar,
wickStrokeWidth,
labels,
events,
render() {
const props = Helpers.modifyProps(this.props, fallbackProps, "axis");
if (this.shouldAnimate()) {
return (
{React.createElement(this.constructor, props)}
);
}
const gridAndTicks = this.renderGridAndTicks(props);
const modifiedGridAndTicks = props.fixLabelOverlap
? this.fixLabelOverlap(gridAndTicks, props)
: gridAndTicks;
const children = [
...modifiedGridAndTicks,
this.renderLine(props),
this.renderLabel(props)
render() {
const { animationWhitelist, role } = VictoryArea;
const props = Helpers.modifyProps(this.props, fallbackProps, role);
if (this.shouldAnimate()) {
return this.animateComponent(props, animationWhitelist);
}
const children = this.renderContinuousData(props);
return props.standalone ? this.renderContainer(props.containerComponent, children) : children;
}
}
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()
render() {
const { role } = this.constructor;
const props = Helpers.modifyProps(this.props, fallbackProps, role);
if (this.shouldAnimate()) {
return this.animateComponent(props, animationWhitelist);
}
const children = this.renderData(props);
return props.standalone ? this.renderContainer(props.containerComponent, children) : children;
}
}
getBaseProps(props, fallbackProps) {
props = Helpers.modifyProps(props, fallbackProps, "voronoi");
const { data, style, scale, polygons, domain } = this.getCalculatedValues(props);
const { width, height, standalone, theme, events, sharedEvents } = props;
const initialChildProps = { parent: {
style: style.parent, scale, domain, data, standalone, height, width, theme
}};
return data.reduce((childProps, datum, index) => {
const polygon = without(polygons[index], "data");
const eventKey = datum.eventKey;
const x = scale.x(datum._x1 !== undefined ? datum._x1 : datum._x);
const y = scale.y(datum._y1 !== undefined ? datum._y1 : datum._y);
const dataProps = {
x, y, datum, data, index, scale, polygon,
size: props.size,
style: this.getDataStyles(datum, style.data)
};
function getCalculatedProps(props, childComponents) {
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"),
const getBaseProps = (props, fallbackProps) => {
const modifiedProps = Helpers.modifyProps(props, fallbackProps, "bar");
props = assign({}, modifiedProps, getCalculatedValues(modifiedProps));
const {
alignment,
barRatio,
cornerRadius,
data,
domain,
events,
height,
horizontal,
origin,
padding,
polar,
scale,
sharedEvents,
standalone,
function getChildren(props, childComponents, calculatedProps) {
props = Helpers.modifyProps(props, fallbackProps, "stack");
childComponents = childComponents || React.Children.toArray(props.children);
calculatedProps = calculatedProps || getCalculatedProps(props, childComponents);
const { datasets } = calculatedProps;
const { labelComponent, polar } = props;
const childProps = getChildProps(props, calculatedProps);
const parentName = props.name || "group";
return childComponents.map((child, index) => {
const role = child.type && child.type.role;
const xOffset = polar
? getPolarX0(props, calculatedProps, index)
: getX0(props, calculatedProps, index);
const style =
role === "voronoi" || role === "tooltip" || role === "label"
? child.props.style
: Wrapper.getChildStyle(child, index, calculatedProps);
const labels = props.labels ? getLabels(props, datasets, index) : child.props.labels;
render() {
const { animationWhitelist, role } = VictoryLine;
const props = Helpers.modifyProps(this.props, fallbackProps, role);
if (this.shouldAnimate()) {
return this.animateComponent(props, animationWhitelist);
}
const children = this.renderContinuousData(props);
return props.standalone ? this.renderContainer(props.containerComponent, children) : children;
}
}