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
  7cbaa9ff_eb45_c5c3_b3e1_fa708854f37a["ChartStyle()"]
  50a748da_ef22_fa55_6f8b_f20abb1db394["chart.tsx"]
  7cbaa9ff_eb45_c5c3_b3e1_fa708854f37a -->|defined in| 50a748da_ef22_fa55_6f8b_f20abb1db394
  style 7cbaa9ff_eb45_c5c3_b3e1_fa708854f37a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/registry/bases/base/ui/chart.tsx lines 72–103

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 apps/v4/registry/bases/base/ui/chart.tsx.
Where is ChartStyle() defined?
ChartStyle() is defined in apps/v4/registry/bases/base/ui/chart.tsx at line 72.

Analyze Your Own Codebase

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

Try Supermodel Free