Legion Dev

Heatmap Chart (Recharts)

Component

About

Calendar heatmap component rendered with Recharts — GitHub contribution graph style. From EvilCharts (legions-developer/evilcharts, MIT), built on Recharts and Motion.

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

Code

How Heatmap Chart (Recharts) is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import { EvilHeatmapChart, type ChartConfig, type HeatmapDatum } from "@/components/ui/evilcharts-recharts-heatmap-chart"

// A year of daily contributions, seeded so the docs render the same picture every time.
function buildContributions(seed: number): HeatmapDatum[] {
  let state = seed;
  const random = () => {
    state = (state * 1664525 + 1013904223) % 4294967296;
    return state / 4294967296;
  };
  const end = Date.UTC(2025, 11, 31);
  const data: HeatmapDatum[] = [];
  for (let i = 364; i >= 0; i--) {
    const day = new Date(end - i * 86_400_000);
    const weekend = day.getUTCDay() === 0 || day.getUTCDay() === 6;
    const active = random() < (weekend ? 0.3 : 0.8);
    if (!active) continue;
    const value = Math.round(random() * (weekend ? 6 : 14)) + 1;
    data.push({ date: day.toISOString().slice(0, 10), value });
  }
  return data;
}

const data = buildContributions(7);

const chartConfig = {
  contributions: {
    label: "Contributions",
    colors: {
      light: ["#9be9a8", "#40c463", "#30a14e", "#216e39"],
      dark: ["#0e4429", "#006d32", "#26a641", "#39d353"],
    },
  },
} satisfies ChartConfig;

export function EvilExampleHeatmapChart() {
  return (
    <EvilHeatmapChart className="h-full w-full p-4" data={data} config={chartConfig}>
      <EvilHeatmapChart.Cell dataKey="contributions" />
      <EvilHeatmapChart.MonthLabel />
      <EvilHeatmapChart.DayLabel />
      <EvilHeatmapChart.Tooltip />
      <EvilHeatmapChart.Legend />
    </EvilHeatmapChart>
  );
}

function Preview() {
  return (
    <div className="h-[300px] w-full max-w-5xl">
      <EvilExampleHeatmapChart />
    </div>
  )
}

export default Preview

Dependencies

More by Legion Dev

View all
  • CPU Architecture

    CPU Architecture

    2K
  • Database With REST API

    Database With REST API

    1.2K
  • Radar Chart

    Radar Chart

    394
  • Pie Chart

    Pie Chart

    254
  • Line Chart

    Line Chart

    136
  • Area Chart

    Area Chart

    128
  • Bar Chart

    Bar Chart

    114
  • Hover Trace Bar Chart

    Hover Trace Bar Chart

    109