Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
return { style, data, scale, domain, origin };
};
const getScale = (props) => {
const axis = Axis.getAxis(props);
const currentAxis = getCurrentAxis(props, axis);
const scale = Scale.getBaseScale(props, axis);
const propsDomain = props.domain && props.domain[axis];
const domain = propsDomain || Axis.getDomain(props) || scale.domain();
scale.range(Helpers.getRange(props, currentAxis));
scale.domain(domain);
return scale;
};
data = [];
}
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 defaultStyles =
props.theme && props.theme.line && props.theme.line.style ? props.theme.line.style : {};
const style = Helpers.getStyles(props.style, defaultStyles);
return { domain, data, scale, style, origin };
};
: {};
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 voronoi = getVoronoi(props, range, scale);
const polygons = voronoi.polygons(data);
const origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
return { domain, data, scale, style, polygons, origin };
};
const getCalculatedValues = (props) => {
const { theme, polar } = props;
const defaultStyle =
theme && theme.candlestick && theme.candlestick.style ? theme.candlestick.style : {};
const style = getStyles(props.style, defaultStyle);
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 origin = polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
const defaultOrientation = props.horizontal ? "top" : "right";
const labelOrientation = props.labelOrientation || defaultOrientation;
return { domain, data, scale, style, origin, labelOrientation };
};
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);
return { style, data, scale, domain, origin };
};
const defaultStyles =
props.theme && props.theme.voronoi && props.theme.voronoi.style
? props.theme.voronoi.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 voronoi = getVoronoi(props, range, scale);
const polygons = voronoi.polygons(data);
const origin = props.polar ? props.origin || Helpers.getPolarOrigin(props) : undefined;
return { domain, data, scale, style, polygons, origin };
};
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 };
};