# Ex chart config default echarts bar chart

A shadcn/ui block from the [@evilcharts](https://evilcharts.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/evilcharts/ex-chart-config-default-echarts-bar-chart).

- Page, with a live preview: https://shadcn.exchange/r/evilcharts/ex-chart-config-default-echarts-bar-chart
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/evilcharts/ex-chart-config-default-echarts-bar-chart-light-2b8087ffc78b6ed3.png
- Registry item: https://evilcharts.com/r/ex-chart-config-default-echarts-bar-chart.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://evilcharts.com/r/ex-chart-config-default-echarts-bar-chart.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@evilcharts/echarts-bar-chart`

## Files

### `src/registry/examples/echarts/ex-chart-config-default-echarts-bar-chart.tsx`

```tsx
"use client";

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

const data = [
  { month: "January", desktop: 342, mobile: 184 },
  { month: "February", desktop: 876, mobile: 491 },
  { month: "March", desktop: 512, mobile: 290 },
  { month: "April", desktop: 629, mobile: 391 },
  { month: "May", desktop: 458, mobile: 309 },
  { month: "June", desktop: 781, mobile: 449 },
  { month: "July", desktop: 394, mobile: 234 },
  { month: "August", desktop: 925, mobile: 557 },
  { month: "September", desktop: 647, mobile: 367 },
  { month: "October", desktop: 532, mobile: 357 },
  { month: "November", desktop: 803, mobile: 515 },
  { month: "December", desktop: 271, mobile: 149 },
];

const chartConfig = {
  desktop: {
    label: "Desktop", // [!code highlight]
    colors: {
      light: ["#047857"], // [!code highlight]
      dark: ["#10b981"], // [!code highlight]
    },
  },
  mobile: {
    label: "Mobile", // [!code highlight]
    colors: {
      light: ["#be123c"], // [!code highlight]
      dark: ["#f43f5e"], // [!code highlight]
    },
  },
} satisfies ChartConfig;

export function EChartsExampleBarChart() {
  return (
    <EChartsBarChart data={data} config={chartConfig} className="h-full w-full p-4">
      <EChartsBarChart.Grid />
      <EChartsBarChart.XAxis dataKey="month" tickFormatter={(value: string) => value.substring(0, 3)} />
      <EChartsBarChart.Legend />
      <EChartsBarChart.Tooltip defaultIndex={4} />
      <EChartsBarChart.Bar dataKey="desktop" variant="default" />
      <EChartsBarChart.Bar dataKey="mobile" variant="default" />
    </EChartsBarChart>
  );
}
```
