MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / ChartStyle

Function ChartStyle

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

Source from the content-addressed store, hash-verified

68ChartContainer.displayName = "Chart"
69
70const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
71 const colorConfig = Object.entries(config).filter(
72 ([, config]) => config.theme || config.color
73 )
74
75 if (!colorConfig.length) {
76 return null
77 }
78
79 return (
80 <style
81 dangerouslySetInnerHTML={{
82 __html: Object.entries(THEMES)
83 .map(
84 ([theme, prefix]) => `
85${prefix} [data-chart=${id}] {
86${colorConfig
87 .map(([key, itemConfig]) => {
88 const color =
89 itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
90 itemConfig.color
91 return color ? ` --color-${key}: ${color};` : null
92 })
93 .join("\n")}
94}
95`
96 )
97 .join("\n"),
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