MCPcopy Create free account
hub / github.com/Thanas-R/Virdis / ChartStyle

Function ChartStyle

src/components/ui/chart.tsx:61–88  ·  view source on GitHub ↗
({ id, config }: { id: string; config: ChartConfig })

Source from the content-addressed store, hash-verified

59ChartContainer.displayName = "Chart";
60
61const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
62 const colorConfig = Object.entries(config).filter(([_, config]) => config.theme || config.color);
63
64 if (!colorConfig.length) {
65 return null;
66 }
67
68 return (
69 <style
70 dangerouslySetInnerHTML={{
71 __html: Object.entries(THEMES)
72 .map(
73 ([theme, prefix]) => `
74${prefix} [data-chart=${id}] {
75${colorConfig
76 .map(([key, itemConfig]) => {
77 const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color;
78 return color ? ` --color-${key}: ${color};` : null;
79 })
80 .join("\n")}
81}
82`,
83 )
84 .join("\n"),
85 }}
86 />
87 );
88};
89
90const ChartTooltip = RechartsPrimitive.Tooltip;
91

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected