BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/EvilCharts/echarts-chart

echarts-chart

evilcharts/echarts-chart
FreeComponent

EvilCharts publishes no description for this item.

Install it

npx shadcn@latest add https://evilcharts.com/r/echarts-chart.json

Source

src/registry/ui/echarts-chart.tsxevilcharts.com/r/echarts-chart.json · first 6 KB
1import type { ComponentType, ReactNode } from "react";
2import * as echarts from "echarts/core";
3
4// ─────────────────────────────────────────────────────────────────────────────
5// Theme keys + config — replicated from the repo's <ChartStyle> so the ECharts
6// charts stay self-contained (no recharts ui imports). Shared by every ECharts
7// chart and the tooltip/legend/brush ui modules.
8// ─────────────────────────────────────────────────────────────────────────────
9
10// Theme selectors mirror the repo's <ChartStyle>: light is the bare root, dark is `.dark`.
11export const THEMES = { light: "", dark: ".dark" } as const;
12export type ThemeKey = keyof typeof THEMES;
13export const THEME_KEYS = Object.keys(THEMES) as ThemeKey[];
14
15// Require at least one theme key — identical constraint to the repo's ChartConfig.
16export type AtLeastOneThemeColor =
17 | { light: string[]; dark?: string[] }
18 | { light?: string[]; dark: string[] };
19
20export type ChartConfig = Record<
21 string,
22 {
23 label?: ReactNode;
24 icon?: ComponentType;
25 colors?: AtLeastOneThemeColor;
26 }
27>;
28
29// ─────────────────────────────────────────────────────────────────────────────
30// Color plumbing — replicated from the repo's <ChartStyle> so the charts stay
31// self-contained (no @/registry/ui/recharts imports).
32// ─────────────────────────────────────────────────────────────────────────────
33
34// Max slots a key needs = longest color array across themes (min 1). Both themes
35// always emit the same number of `--color-{key}-{n}` vars.
36export function getColorsCount(item: ChartConfig[string]): number {
37 if (!item.colors) return 1;
38 const counts = THEME_KEYS.map((theme) => item.colors?.[theme]?.length ?? 0);
39 return Math.max(...counts, 1);
40}
41
42// Distribute colors evenly across slots; extra slots go to the LAST color(s).
43// … truncated

What it pulls in

npm packages

  • echarts

Files it writes

  • src/registry/ui/echarts-chart.tsx

Facts

Registry
EvilCharts
Type
registry:component
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

evilcharts.com legions-developer/evilcharts on GitHub Raw registry item This item as JSON

More from EvilCharts

All 271 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
echarts-area-chartecharts-area-chartEvilChartsComponentsFree2 deps
echarts-bar-chartecharts-bar-chartEvilChartsComponentsFree2 deps
echarts-brushecharts-brushEvilChartsComponentsFree1 dep
echarts-composed-chartecharts-composed-chartEvilChartsComponentsFree2 deps
echarts-dotecharts-dotEvilChartsComponentsFree1 dep
echarts-legendecharts-legendEvilChartsComponentsFreeno deps
echarts-line-chartecharts-line-chartEvilChartsComponentsFree2 deps
echarts-pie-chartecharts-pie-chartEvilChartsComponentsFree2 deps
BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex