UNPKG

victory-native

Version:

A charting library for React Native with a focus on performance and customization.

22 lines (21 loc) 701 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getHorizontalStackedBarRect = void 0; const getHorizontalStackedBarRect = ({ segment, xScale, barWidth, }) => { const { y } = segment.point; const startX = xScale(segment.startValue); const endX = xScale(segment.endValue); if (typeof y !== "number" || !Number.isFinite(y) || !Number.isFinite(startX) || !Number.isFinite(endX)) { return null; } return { x: Math.min(startX, endX), y: y - barWidth / 2, width: Math.abs(endX - startX), height: barWidth, }; }; exports.getHorizontalStackedBarRect = getHorizontalStackedBarRect;