edbnedbn/ui
ComponentsTablesChartsPDFsStandards
GitHub stars
Explorer
    • Overview
    • Usage
    • Area
    • Hover Highlight
    • Basic
    • Svg Renderer
    • Brush
    • Buffer
    • Hover Reveal
    • Animated Dashed Stroke
    • Bump Curve Type
    • Dashed Stroke
    • Default Type
    • Dotted Area Variant
    • Expanded Type
    • Gradient Area Variant
    • Gradient Colors
    • Gradient Colors Bump
    • Gradient Reverse Area Variant
    • Hatched Area Variant
    • Lines Area Variant
    • Loading State
    • Monotoney Curve Type
    • Solid Area Variant
    • Solid Stroke
    • Stacked Type
    • Step Curve Type
    • Bar
    • Basic
    • Svg Renderer
    • Buffer
    • Gradient Colors
    • Loading State
    • Default Variant
    • Expandable Variant
    • Max Highlight
    • Blocks Variant
    • Hatched Variant
    • Duotone Variant
    • Duotone Reverse Variant
    • Gradient Variant
    • Stripped Variant
    • Stacked Type
    • Percent Type
    • Horizontal Layout
    • Hover Highlight
    • Glowing Desktop
    • Glowing Mobile
    • Tooltip Default
    • Tooltip Frosted Glass
    • Chart Config Default
    • Chart Config Icons
    • Composed
    • Basic
    • Svg Renderer
    • Gradient Colors
    • Loading State
    • Hatched Variant
    • Duotone Variant
    • Gradient Variant
    • Stripped Variant
    • Dashed Stroke
    • Animated Dashed Stroke
    • Bump Curve
    • Dots
    • Hover Highlight
    • Glowing
    • Line
    • Basic
    • Svg Renderer
    • Gradient Colors
    • Gradient Colors Bump
    • Loading State
    • Bump Curve Type
    • Step Curve Type
    • Monotoney Curve Type
    • Solid Stroke
    • Dashed Stroke
    • Animated Dashed Stroke
    • Glowing Desktop
    • Glowing Mobile
    • Buffer
    • Hover Reveal
    • Dot Default
    • Dot Border
    • Dot Colored Border
    • Dot Ping
    • Legend Square
    • Legend Circle
    • Legend Circle Outline
    • Legend Rounded Square
    • Legend Rounded Square Outline
    • Legend Vertical Bar
    • Legend Horizontal Bar
    • Pie
    • Basic
    • Svg Renderer
    • Gradient Colors
    • Donut
    • Padded
    • Overlapping Padded
    • Labels
    • Loading State
    • Outside Labels
    • Radar
    • Basic
    • Svg Renderer
    • Lines Variant
    • Circle Grid
    • Gradient Colors
    • Loading State
    • Radial
    • Basic
    • Svg Renderer
    • Semi Variant
    • Gradient Colors
    • Loading State
    • Sankey
    • Basic
    • Svg Renderer
    • Gradient Colors
    • Loading State
    • Solid Link Variant
    • Source Link Variant
    • Labeled Nodes
    • Outside Labels
    • Solid Labeled Nodes
    • Allocation
    • Audience
    • Benchmark
    • Budget
    • Cache Tiers
    • Grid
    • Latency
    • Market Share
    • Monospace
    • Payouts
    • Peak
    • Pipeline
    • Portfolio
    • Progress Rings
    • Reliability Score
    • Revenue Mix
    • Ride
    • Shipments
    • Attribution

Usage

Use the existing Evil Charts compound API with a stable, explicitly sized container.

revenue-chart.tsx
25 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"use client";

import { EChartsBarChart, type ChartConfig } from "@/components/charts/echarts-bar-chart";

const config = {
  revenue: { label: "Revenue", colors: { light: ["#047857"], dark: ["#10b981"] } },
} satisfies ChartConfig;

export function RevenueChart() {
  return (
    <EChartsBarChart
      data={[{ month: "January", revenue: 342 }, { month: "February", revenue: 876 }]}
      config={config}
      ariaLabel="Monthly revenue in dollars"
      className="h-80 w-full"
      xDataKey="month"
    >
      <EChartsBarChart.Grid />
      <EChartsBarChart.XAxis dataKey="month" />
      <EChartsBarChart.Bar dataKey="revenue" isClickable />
      <EChartsBarChart.Tooltip />
      <EChartsBarChart.Legend isClickable />
    </EChartsBarChart>
  );
}

Size and lifecycle

Set a positive height on the chart. Initialization waits until the container is visible and has a width and height. Resize and theme updates preserve selection and brush ranges. Canvas is the default; use renderer="svg" for SVG. Changing the renderer recreates the rendering surface.

Data

Cartesian charts retain negative values and show missing or non-finite samples as gaps. Empty data shows a status message. Pie and radial charts require non-negative magnitudes; zero totals show an empty state. Sankey nodes require unique names, valid link endpoints, finite non-negative values, and an acyclic graph. Corrected data can recover in place.

Accessibility and motion

Give the chart a meaningful ariaLabel. Clickable legends support Enter and Space. Brush start and end controls support keyboard range adjustment and appear on focus. Reduced motion disables entrance and looping decoration. Include a data table when exact values are important to your audience.

Theme and tooltips

ChartConfig supports light and dark color arrays, labels, and icons. Theme colors resolve from the chart’s own document, including iframe previews. Built-in tooltip labels and values are escaped. Custom chartOptions formatters are trusted application code: escape any untrusted HTML they return.