diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md index 2474d6fa2..e660834b3 100644 --- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md +++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md @@ -189,7 +189,10 @@ work extends shared components instead of creating new local variants. attributes and shared state/model helpers for cursor, axis-label, and tooltip positioning, but it must not write inline `style=` attributes for tick labels, tooltip placement, or per-series transitions on the public - shell. + shell. Axis labels must render in fixed-size SVG shells or another + non-scaled primitive boundary; the shared sparkline must not put axis glyphs + inside `preserveAspectRatio="none"` label viewBoxes that stretch text as the + chart resizes. The same shared presentation boundary also owns reusable scroll containers: `frontend-modern/src/components/shared/Table.tsx` must keep touch-scroll behavior on classes and shared CSS in `frontend-modern/src/index.css` diff --git a/frontend-modern/src/components/shared/InteractiveSparkline.tsx b/frontend-modern/src/components/shared/InteractiveSparkline.tsx index 0e304fb75..e5a54051c 100644 --- a/frontend-modern/src/components/shared/InteractiveSparkline.tsx +++ b/frontend-modern/src/components/shared/InteractiveSparkline.tsx @@ -15,6 +15,17 @@ const verticalTextBaseline = (anchor: 'top' | 'middle' | 'bottom') => anchor === 'top' ? 'hanging' : anchor === 'bottom' ? 'text-bottom' : 'middle'; const horizontalTextAnchor = (anchor: 'start' | 'middle' | 'end') => anchor; +const axisPositionPercent = (value: number, total: number) => `${(value / total) * 100}%`; +const sparklineLeftInsetClass = (size?: InteractiveSparklineProps['size']) => + size === 'lg' ? 'ml-10' : 'ml-8'; +const sparklineYAxisWidthClass = (size?: InteractiveSparklineProps['size']) => + size === 'lg' ? 'w-10' : 'w-8'; +const sparklineXAxisHeightClass = (size?: InteractiveSparklineProps['size']) => + size === 'lg' ? 'h-5' : 'h-4'; +const sparklineYAxisFontSize = (size?: InteractiveSparklineProps['size']) => + size === 'lg' ? '12' : '10'; +const sparklineXAxisFontSize = (size?: InteractiveSparklineProps['size']) => + size === 'lg' ? '12' : '10'; const tooltipWidth = (hover: InteractiveSparklineHoverState) => (hover.focusedTooltip ? 112 : 138); @@ -51,7 +62,7 @@ export const InteractiveSparkline: Component = (props data-summary-chart-state={interactionState()} >
-
+
= (props
-
+
-
+