MCPcopy Create free account
hub / github.com/TheOrcDev/orcish-fullstack-admin / ChartStyle

Function ChartStyle

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

Source from the content-addressed store, hash-verified

69ChartContainer.displayName = "Chart";
70
71const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
72 const colorConfig = Object.entries(config).filter(
73 // eslint-disable-next-line no-unused-vars
74 ([_, config]) => config.theme || config.color
75 );
76
77 if (!colorConfig.length) {
78 return null;
79 }
80
81 return (
82 <style
83 dangerouslySetInnerHTML={{
84 __html: Object.entries(THEMES).map(
85 ([theme, prefix]) => `
86${prefix} [data-chart=${id}] {
87${colorConfig
88 .map(([key, itemConfig]) => {
89 const color =
90 itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
91 itemConfig.color;
92 return color ? ` --color-${key}: ${color};` : null;
93 })
94 .join("\n")}
95}
96`
97 ),
98 }}
99 />
100 );
101};
102
103const ChartTooltip = RechartsPrimitive.Tooltip;
104

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected