UNPKG

react-native-chart-kit

Version:

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

31 lines (30 loc) 1.38 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { getFontFamilyProps } from "./text"; const getDebugStroke = (kind) => { switch (kind) { case "outer": return "#ef4444"; case "plot": return "#22c55e"; case "legend": return "#a855f7"; case "tooltip": return "#f97316"; case "axis": return "#eab308"; case "label": default: return "#2563eb"; } }; export const renderLineChartDebugLayout = ({ fontFamily, model, renderer }) => { const { Group, Rect, Text } = renderer; const canRenderText = renderer.capabilities?.text !== false; return model.rects.map((rect, index) => { const stroke = getDebugStroke(rect.kind); const dashProps = rect.kind === "outer" || rect.kind === "plot" ? {} : { strokeDasharray: [4, 3] }; return (_jsxs(Group, { children: [_jsx(Rect, { fill: "none", height: rect.height, stroke: stroke, strokeOpacity: 0.9, strokeWidth: 1, width: rect.width, x: rect.x, y: rect.y, ...dashProps }), rect.text && canRenderText ? (_jsx(Text, { fill: stroke, fontSize: 9, text: rect.text, x: rect.x + 2, y: Math.max(10, rect.y - 3), ...getFontFamilyProps(fontFamily), children: rect.text })) : null] }, `debug-${rect.kind}-${rect.id}-${index}`)); }); };