echarts-brush
evilcharts/echarts-brushFreeComponent
EvilCharts publishes no description for this item.
Install it
npx shadcn@latest add https://evilcharts.com/r/echarts-brush.jsonSource
1import { withAlpha, type ResolvedColors } from "@/registry/ui/echarts-chart";2import type { DataZoomComponentOption } from "echarts/components";3import type { FC } from "react";4import * as echarts from "echarts/core";56type EChartsInstance = ReturnType<typeof echarts.init>;78const BRUSH_BORDER_OPACITY = 1; // brush frame, × border alpha (evil-brush uses the full token)910export { BRUSH_BORDER_OPACITY };1112// ─────────────────────────────────────────────────────────────────────────────13// Brush marker — the declarative `<Chart.Brush/>` child. Rendering nothing, its14// PRESENCE turns the brush on (replacing the old showBrush prop) and its props15// carry the brush's height, handle-label formatter, and range callback. Shared16// so every cartesian chart attaches the SAME component to its root.17// ─────────────────────────────────────────────────────────────────────────────1819export interface BrushProps {20 height?: number; // brush preview strip height in px (default 56)21 formatLabel?: (value: string, index: number) => string; // formats the range-handle labels22 onChange?: (range: { startIndex: number; endIndex: number }) => void; // fires as the range moves23}2425/** Declares the zoom brush below the chart. Presence renders it; renders nothing itself. */26export const Brush: FC<BrushProps> = () => null;2728// ─────────────────────────────────────────────────────────────────────────────29// Brush overlays — the evil-brush look: a rounded border around the SELECTED30// range, dimmed unselected sides, centered grip-dot handle pills, and range31// label pills below the frame. None of that is a dataZoom capability. They are32// raw zrender elements updated imperatively — routing them through setOption33// re-renders the dataZoom component mid-drag, resetting its drag anchor (the34// handle progressively lags the pointer).35// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from EvilCharts
All 271 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| echarts-area-chartecharts-area-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-bar-chartecharts-bar-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-chartecharts-chart | EvilCharts | Components | Free | 1 dep | |
| echarts-composed-chartecharts-composed-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-dotecharts-dot | EvilCharts | Components | Free | 1 dep | |
| echarts-legendecharts-legend | EvilCharts | Components | Free | no deps | |
| echarts-line-chartecharts-line-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-pie-chartecharts-pie-chart | EvilCharts | Components | Free | 2 deps |
