0.1.4 ā€¢ Published 4 years ago

react-time-heatmap v0.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

react-time-heatmap

Netlify Status

Show a heatmap based on the time of day for several days

šŸ˜Ž Demo: https://react-time-heatmap.netlify.app/

The component takes time entries and displays the count as a heatmap.

āœ” add entries for an unlimited number of days

āœ” select the number of groups/levels to show in colours (light blue to dark blue)

āœ” can be made to flow and use all the space it has, responsively

āœ” has no dependencies

Install

npm i --save react-time-heatmap

Import

import { ITimeEntry, TimeHeatMap } from "react-time-heatmap";

Examples

Shows entries

<TimeHeatMap timeEntries={entries} />

Shows entries into a custom number of groups

<TimeHeatMap timeEntries={entries} numberOfGroups={7} />

Shows count for every hour (use for debugging)

<TimeHeatMap timeEntries={entries} showCounts={true} />

Available options

OptionRequiredDescriptionDefault value
timeEntriesyesarray of entries, needs to have 24 entries per day[]
numberOfGroupsnothe number of groups to split the colours into4
flownoallow the component to take the full width of its containerfalse
textForNoTimeEntriesnocustom text to show when there are no entries loaded"No time entries"
showCountsnoshows the counts for every hour, for testingfalse
showGroupsnoshows the groups under the heat maptrue
showHoursnoshows the hourstrue

Entries example, 7 days or 168 hours with counts between 0 and 1000 (image shortened)

Entries example

āœ” hours, minutes or time zone are not relevant

āœ” time needs to be a valid date

āœ” the entries will be sorted by the component (left to right, past to present)

šŸ‘ typescript will make sure you type everything right

Examples

Base example (7 days)Custom nr. groups (10 days)Show counts
Base exampleCustom nr. groupsShow counts

Flow enabled, responsive

Show counts

About

  • made with React Hooks
  • uses CSS Grid to create the arrangement
  • styles applied with sass modules
  • the animations in the images are just an example, the component will rerender only when new entries are passed
  • support by any browser that supports grids (not IE)

Checkout more of me and my work at https://projectsbydan.com

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

1.0.0

4 years ago