react-native-chart-kit
Version:
Beautiful React Native charts for dashboards, reports, and data-rich mobile apps.
38 lines (37 loc) • 1.23 kB
JavaScript
export const getLineChartOutsidePressSurfaces = ({ enabled, mainHeight, visibleInteractionBounds, width }) => {
if (!enabled) {
return [];
}
const surfaces = [
{
key: "top",
height: visibleInteractionBounds.y,
left: 0,
top: 0,
width
},
{
key: "left",
height: visibleInteractionBounds.height,
left: 0,
top: visibleInteractionBounds.y,
width: visibleInteractionBounds.x
},
{
key: "right",
height: visibleInteractionBounds.height,
left: visibleInteractionBounds.x + visibleInteractionBounds.width,
top: visibleInteractionBounds.y,
width: width - (visibleInteractionBounds.x + visibleInteractionBounds.width)
},
{
key: "bottom",
height: mainHeight -
(visibleInteractionBounds.y + visibleInteractionBounds.height),
left: 0,
top: visibleInteractionBounds.y + visibleInteractionBounds.height,
width
}
];
return surfaces.filter((surface) => surface.width > 0 && surface.height > 0);
};