Legion Dev

ECharts Sankey Chart

Component 1

About

A flow diagram chart built on Apache ECharts that visualizes how a quantity moves between stages (e.g. funnel or budget flows) through animated, colored nodes and links.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds ECharts Sankey Chart to your project and fits it to your theme.

Code

How ECharts Sankey Chart is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import {
  EChartsSankeyChart,
  type SankeyData,
  type ChartConfig,
} from "@/components/ui/echarts-sankey-chart";

// Content distribution - how content flows to platforms
const data: SankeyData = {
  nodes: [
    { name: "BlogPosts" },
    { name: "Videos" },
    { name: "Podcasts" },
    { name: "Twitter" },
    { name: "LinkedIn" },
    { name: "YouTube" },
    { name: "Newsletter" },
  ],
  links: [
    { source: 0, target: 3, value: 12000 },
    { source: 0, target: 4, value: 8500 },
    { source: 0, target: 6, value: 15000 },
    { source: 1, target: 5, value: 28000 },
    { source: 1, target: 3, value: 4200 },
    { source: 2, target: 5, value: 9800 },
    { source: 2, target: 4, value: 3600 },
  ],
};

const chartConfig = {
  BlogPosts: {
    label: "Blog Posts",
    colors: {
      light: ["#3b82f6"],
      dark: ["#60a5fa"],
    },
  },
  Videos: {
    label: "Videos",
    colors: {
      light: ["#ef4444"],
      dark: ["#f87171"],
    },
  },
  Podcasts: {
    label: "Podcasts",
    colors: {
      light: ["#8b5cf6"],
      dark: ["#a78bfa"],
    },
  },
  Twitter: {
    label: "Twitter",
    colors: {
      light: ["#0ea5e9"],
      dark: ["#38bdf8"],
    },
  },
  LinkedIn: {
    label: "LinkedIn",
    colors: {
      light: ["#0077b5"],
      dark: ["#0a95d9"],
    },
  },
  YouTube: {
    label: "YouTube",
    colors: {
      light: ["#dc2626"],
      dark: ["#ef4444"],
    },
  },
  Newsletter: {
    label: "Newsletter",
    colors: {
      light: ["#10b981"],
      dark: ["#34d399"],
    },
  },
} satisfies ChartConfig;

export default function EChartsExampleSankeyChart() {
  return (
    <div className="w-full h-screen">
      <EChartsSankeyChart
        className="h-full w-full p-4"
        data={data}
        config={chartConfig}
        isLoading
      >
        <EChartsSankeyChart.Node />
        <EChartsSankeyChart.Link variant="source" />
        <EChartsSankeyChart.Tooltip />
      </EChartsSankeyChart>
    </div>
  );
}

Dependencies

More by Legion Dev

View all
  • CPU Architecture

    CPU Architecture

    1.9K
  • Database With REST API

    Database With REST API

    1.2K
  • Radar Chart

    Radar Chart

    352
  • Pie Chart

    Pie Chart

    222
  • Line Chart

    Line Chart

    127
  • Area Chart

    Area Chart

    110
  • Bar Chart

    Bar Chart

    98
  • LegionWebDev

    LegionWebDev

    86