chartRadarGridCustom
A Charts block/component from shadcn/ui — clean-room reimplemented for Domphy (see methodology). Call chartRadarGridCustom() with no arguments for a working demo, or edit the code below live.
Implementation notes
Single polygon ring at a configurable fraction of the plot radius (default 0.75, chosen for a 'roughly mid-to-outer' look in this port's own 200-unit viewBox - the spec's upstream absolute ~90px figure doesn't map 1 onto a differently-sized coordinate space, so an own-judgment proportional value was used instead), no radial spokes.
Status: ported · Reference: shadcn/ui original
// shadcn/ui "charts/radar-grid-custom" recipe — clean-room reimplementation.
//
// A stripped-down grid: just one thin polygon ring at a fixed (roughly
// mid-to-outer) radius, no radial spoke lines, deliberately understated so
// the data shape reads as the dominant visual element. Minimal, value-only
// hover tooltip.
//
// Implemented purely from the block's public functional/visual spec — no
// upstream shadcn/ui source was viewed or copied.
import type { DomphyElement } from "@domphy/core";
import { chartTrendFooter, type ChartTrendDirection } from "./chart-area-shared.js";
import {
RADAR_SINGLE_SERIES,
RADAR_MONTHLY_SINGLE_DATA,
createRadarTooltip,
radarCardShell,
renderRadarChart,
type RadarPoint,
type RadarSeriesConfig,
} from "./chart-radar-shared.js";
export interface ChartRadarGridCustomProps {
data?: RadarPoint[];
series?: RadarSeriesConfig[];
title?: string;
description?: string;
trendText?: string;
trendDirection?: ChartTrendDirection;
captionText?: string;
ringFraction?: number;
showSpokes?: boolean;
}
/**
* shadcn/ui "charts/radar-grid-custom" recipe — a single-series radar chart
* over a single custom ring. Call with no arguments for a working demo.
*/
function chartRadarGridCustom(props: ChartRadarGridCustomProps = {}): DomphyElement<"div"> {
const {
data = RADAR_MONTHLY_SINGLE_DATA,
series = RADAR_SINGLE_SERIES,
title = "Radar Chart - Grid Custom",
description = "January - June 2026",
trendText = "Trending up by 5.2% this month",
trendDirection = "up",
captionText = "Showing total visitors for the last 6 months",
ringFraction = 0.75,
showSpokes = false,
} = props;
const tooltip = createRadarTooltip();
return radarCardShell({
title,
description,
content: {
div: [
renderRadarChart({
data,
series,
tooltip,
gridRingFractions: [ringFraction],
gridShowSpokes: showSpokes,
tooltipShowLabel: false,
tooltipIndicator: "none",
}),
],
},
footer: chartTrendFooter({ trendText, direction: trendDirection, captionText }),
});
}
export { chartRadarGridCustom };