Home / Function/ ChartStyle() — ui Function Reference

ChartStyle() — ui Function Reference

Architecture documentation for the ChartStyle() function in chart.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  29b3f24c_7cea_a028_7771_16e2159e6684["ChartStyle()"]
  b01a5853_7a04_0011_7a8b_ab9fc567a8f0["chart.tsx"]
  29b3f24c_7cea_a028_7771_16e2159e6684 -->|defined in| b01a5853_7a04_0011_7a8b_ab9fc567a8f0
  style 29b3f24c_7cea_a028_7771_16e2159e6684 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/registry/default/ui/chart.tsx lines 70–101

const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
  const colorConfig = Object.entries(config).filter(
    ([, config]) => config.theme || config.color
  )

  if (!colorConfig.length) {
    return null
  }

  return (
    <style
      dangerouslySetInnerHTML={{
        __html: Object.entries(THEMES)
          .map(
            ([theme, prefix]) => `
${prefix} [data-chart=${id}] {
${colorConfig
  .map(([key, itemConfig]) => {
    const color =
      itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
      itemConfig.color
    return color ? `  --color-${key}: ${color};` : null
  })
  .join("\n")}
}
`
          )
          .join("\n"),
      }}
    />
  )
}

Subdomains

Frequently Asked Questions

What does ChartStyle() do?
ChartStyle() is a function in the ui codebase, defined in deprecated/www/registry/default/ui/chart.tsx.
Where is ChartStyle() defined?
ChartStyle() is defined in deprecated/www/registry/default/ui/chart.tsx at line 70.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free