npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

activity-heatmap

v2.0.2

Published

A d3 heatmap for representing time series data similar to GitHub's contribution graph

Readme

Activity Heatmap

Demo

A D3.js heatmap visualization for time series data, similar to GitHub's contribution graph.

Inspired by DKirwan's Calendar Heatmap.

Demo

Live Demo

Screenshots

Yearly profile

Yearly heatmap

Monthly profile

Monthly heatmap

Features

  • Heatmap with customizable color scales
  • Histogram view
  • Labels and scales
  • Flexible time granularity (yearly, monthly, or custom)
  • ES6 module support
  • Fully localizable (uses day.js formatting)

Installation

npm

npm install activity-heatmap

CDN (Standalone)

<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1"></script>
<script src="https://cdn.jsdelivr.net/npm/activity-heatmap/dist/activity-heatmap.standalone.iife.js"></script>

Usage

ES6 Modules

import * as d3 from 'd3';
import { ActivityHeatmap } from 'activity-heatmap';

const data = await d3.json('data.json');
data.forEach(d => {
  d.date = new Date(d.timestamp);
  d.value = +d.value;
});

const map = new ActivityHeatmap(data, 'yearly', '#my-heatmap');
map.render();

Script Tag (Standalone)

<div id="my-heatmap"></div>
<script>
  d3.json('data.json').then(data => {
    data.forEach(d => {
      d.date = new Date(d.timestamp);
      d.value = +d.value;
    });

    const map = new ActivityHeatmap(data, 'yearly', '#my-heatmap');
    map.render();
  });
</script>

Tooltip Styles

Add CSS for tooltips:

.heatmap-tooltip {
  position: absolute;
  z-index: 9999;
  padding: 5px 9px;
  color: #fff;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 3px;
  text-align: center;
  pointer-events: none;
}

Options

The constructor accepts three arguments:

  1. data - Array of data points with date and value properties
  2. profile - Profile name ('yearly' or 'monthly')
  3. options - Options object or CSS selector string
const options = {
  selector: '#my-heatmap',
  debug: false,
  legend: true,
  histogram: true,
  frame: true,
  colors: {
    separator: '#AAAAAA',
    frame: '#AAAAAA',
    scale: ['#D8E6E7', '#218380']
  }
};

const map = new ActivityHeatmap(data, 'yearly', options);

// Override options after instantiation
map.options.period.from = new Date('2020-01-01');

map.render();

Inline Render

The render() method can be used with your own SVG element:

const mySvg = d3.select('#container').append('svg');
const heatmap = map.render(mySvg, 100, 50); // with x, y offset

Returns an SVG group containing the heatmap.

Development

# Install dependencies
npm install

# Run dev server
npm run dev

# Build library
npm run build

# Build demo for GitHub Pages
npm run build:demo

Dependencies

License

MIT