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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@manufac/reactjs-calendar-heatmap

v1.0.12

Published

React component for d3.js calendar heatmap graph.

Downloads

15

Readme

Drilldown Calendar Heatmap | ReactJS | D3

This d3.js heatmap representing time series data is used to visualize the frequency of an entity over time.

Includes a global overview of multiple years and visualizations of year, month and day overviews.

Inspired by

Demo

Live Link

Global overview

Global

Year overview

Year

Month overview

Month

Day overview

Day

Install

  1. Install @manufac/reactjs-calendar-heatmap with yarn (or npm):
yarn add @manufac/reactjs-calendar-heatmap

NPM Location

  1. Import DrilldownCalendar in your component
import {
    DrilldownCalendar
} from '@manufac/reactjs-calendar-heatmap';
  1. Render DrilldownCalendar component
<DrilldownCalendar
  color={color}
  data={data}
  overview={overview}
  response={response}
  showDayXAxisLabels={showDayXAxisLabels}
  onTooltip={show}
  onHideTooltip={hide}
  fetchGlobalData={fetchGlobalData}
  fetchDayData={fetchDayData}
/>

CDN

Available via JSDelivr.

Interfaces

export interface CalendarHeatmapDetail {
  date: string;
  value: number;
}
interface CalendarHeatmapDatum {
  date: string;
  total: number;
  details?: CalendarHeatmapDetail[];
}

Properties

| Property | Type | Usage | Default | Required | |:-------------------|:-------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------|:-----------:|:--------:| | data | CalendarHeatmapDatum[] | Time series data spanning over 1 year or more years | none | yes | | color | color hex code, valid css color name or color scheme names ( 'spectral' , 'hsl' , or 'hslModified' ) | Theme color for the visual elements | '#ff4500' | no | | overview | 'global' \| 'year' \| 'month' \| 'week' \| 'day' | Initial overview for the map | 'year' | no | | response | 'hide' \| 'rotate' \| 'offset' | Responsiveness strategy for handling overlapping axis labels | 'hide' | no | | showDayXAxisLabels | boolean | To show X Axis labels for day overview heatmap | none | no | | onTooltip | (datum: { value: unknown }) => void; | onTooltip function is fired on "mouseover" over a visual element | none | no | | onHideTooltip | () => void; | onHideTooltip function is fired on "mouseout" over a visual element | none | no | | fetchGlobalData | () => Promise<CalendarHeatmapDatum[]>; | To fetch data for 'global', 'year' or 'month' overview heatmap from a REST API | none | no | fetchDayData | (dateTime: string) => Promise<CalendarHeatmapDatum['details']>; | To fetch data for 'day' overview heatmap from a REST API | none | no

Example data

The data contains:

  • Day-by-day frequency of an arbitrary event spaninng across 1 or more years
  • For each data point, the intra-day frequency is also optionally listed in details
var data = [{
        "date": "2016-01-01",
        "total": 17164,
        "details": [{
                "date": "2016-01-01 12:30:45",
                "value": 9192
            },
            ...{
                "date": "2016-01-01 17:52:41",
                "value": 1219
            }
        ]
    },
    {
        "date": "2016-01-02",
        "total": 17100,
        "details": [{
                "date": "2016-01-02 11:30:00",
                "value": 9132
            },
            ...{
                "date": "2016-01-02 15:52:00",
                "value": 1219
            }
        ]
    }
]