const getMaxRadius = () => { const minPadding = Math.min(...values(Helpers.getPadding(props))); return Math.max(minPadding, 5); };
return Math.max(radius, 1); }, getSize(data, props, calculatedProps) { if (data.size) { return typeof data.size === "function" ? data.size : Math.max(data.size, 1); } else if (typeof props.size === "function") { return props.size; } else if (data[calculatedProps.z]) { return this.getBubbleSize(data, props, calculatedProps); } else { return Math.max(props.size, 1); } }, getPath(props) { const pathFunctions = { circle: pathHelpers.circle, square: pathHelpers.square, diamond: pathHelpers.diamond, triangleDown: pathHelpers.triangleDown, triangleUp: pathHelpers.triangleUp, plus: pathHelpers.plus, star: pathHelpers.star }; const size = Helpers.evaluateProp(props.size, props.data); const symbol = Helpers.evaluateProp(props.symbol, props.data); return pathFunctions[symbol].call(null, props.x, props.y, size); } };
getStringsFromCategories(props, axis) { // TODO generalize for independent vertical axes if (!props.categories || axis !== "x") { return []; } else { const categoryArray = compact(flatten(props.categories)); return categoryArray.filter((val) => typeof val === "string"); } }, getStringsFromData(props, axis) { if (!props.data) { return []; } const accessor = Helpers.createAccessor(has(props, axis) ? props[axis] : axis); const dataStrings = (props.data) .map((datum) => accessor(datum)) .filter((datum) => typeof datum === "string"); // return a unique set of strings return compact(uniq(dataStrings)); }, // for components that take single datasets getData(props) { if (props.data) { return this.formatData(props.data, props); } const data = this.generateData(props); return this.formatData(data, props); },
uniq(flatten(props.data.map((dataset) => { return Helpers.getStringsFromData(merge({}, props, {data: dataset}), axis); })))
if (props.orientation) { const vertical = {top: "x", bottom: "x", left: "y", right: "y"}; return vertical[props.orientation]; } const axisType = props.dependentAxis ? "dependent" : "independent"; const flippedAxis = { dependent: "x", independent: "y"}; const normalAxis = { independent: "x", dependent: "y"}; return flipped ? flippedAxis[axisType] : normalAxis[axisType]; }, // exposed for use by VictoryChart getScale(props) { const axis = this.getAxis(props); const scale = Scale.getBaseScale(props, axis); const domain = this.getDomain(props) || scale.domain(); scale.range(Helpers.getRange(props, axis)); scale.domain(domain); return scale; }, getTicks(props, scale) { if (props.tickValues) { if (Axis.stringTicks(props)) { return range(1, props.tickValues.length + 1); } return props.tickValues; } else if (scale.ticks && typeof scale.ticks === "function") { const ticks = scale.ticks(props.tickCount); if (props.crossAxis) { return includes(ticks, 0) ? without(ticks, 0) : ticks; }