UNPKG

react-native-chart-kit

Version:

Beautiful React Native charts for dashboards, reports, and data-rich mobile apps.

21 lines (20 loc) 594 B
const withKind = (rect, kind) => ({ ...rect, kind }); export const buildLayoutDebugModel = ({ boxes, labels = [], legend, tooltip }) => { const rects = [ withKind({ id: "outer", ...boxes.outer }, "outer"), withKind({ id: "plot", ...boxes.plot }, "plot") ]; labels.forEach((label) => { rects.push(withKind(label, "label")); }); legend?.items.forEach((item) => { rects.push(withKind(item, "legend")); }); if (tooltip) { rects.push(withKind({ id: "tooltip", ...tooltip.rect }, "tooltip")); } return { rects }; };