MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / ChartStyle

Function ChartStyle

packages/react/src/components/chart.tsx:90–120  ·  view source on GitHub ↗
({ id, config }: { id: string; config: ChartConfig })

Source from the content-addressed store, hash-verified

88}
89
90const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
91 const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
92
93 if (!colorConfig.length) {
94 return null;
95 }
96
97 return (
98 <style
99 dangerouslySetInnerHTML={{
100 __html: Object.entries(THEMES)
101 .map(
102 ([theme, prefix]) => `
103${prefix} [data-chart=${id}] {
104${colorConfig
105 .map(([key, itemConfig]) => {
106 const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ?? itemConfig.color;
107 const variableName = chartCssVariableName(key);
108 const colorValue = color ? chartCssColorValue(color) : null;
109 return variableName && colorValue ? ` ${variableName}: ${colorValue};` : null;
110 })
111 .filter((line): line is string => line !== null)
112 .join("\n")}
113}
114`,
115 )
116 .join("\n"),
117 }}
118 />
119 );
120};
121
122const ChartTooltip = RechartsPrimitive.Tooltip;
123

Callers

nothing calls this directly

Calls 2

chartCssVariableNameFunction · 0.85
chartCssColorValueFunction · 0.85

Tested by

no test coverage detected