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

Relationship Graph

Source Code

deprecated/www/registry/new-york/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/new-york/ui/chart.tsx.
Where is ChartStyle() defined?
ChartStyle() is defined in deprecated/www/registry/new-york/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