1.1.5 • Published 5 years ago

react-d3-heatmap v1.1.5

Weekly downloads
84
License
MIT
Repository
github
Last release
5 years ago

react-d3-heatmap

Build

A simple React heat map to visualize your data between two dates using d3.js

This heat map will display squares inside SVG. A square represent a day.

Now, it supports Typescript 🎉

Demo

Here is a preview Or View with the whole code

Installation

npm i react-d3-heatmap

or

yarn add react-d3-heatmap

Usage

react-d3-heatmap is very easy to use.

Here is a basic usage :

<HeatMapDate
    startDate={startDate}
    endDate={endDate}
    data={data}
    colors={colors}
    displayLegend
/>

Documentation

You can change these props :

PropDefinitionTypeIs required ?Default
dataYour data to visualize. It must be an array of objects that contain a date and a numberArray[{date: Date, count: Number}]true
startDateYour heat map will begin at this dateDatetrue
endDateYour heat map will end at this dateDatetrue
colorsLet's colorize this heat map It must be an array of objects that a number and a color like "#232323"Array[{count: Number, color: String, text: string (optional)}]true
defaultColorA string that contain a default colorStringfalse"#cdcdcd"
textDefaultColorA tooltip's text displayed in legend for default colorStringfalse"0"
rectWidthSet width and height for each squareNumberfalse10
marginRightSpace between two squares on x axisNumberfalse4
marginBottomSpace between two squares on y axisNumberfalse4
displayLegendDisplay or not a legendBooleanfalsetrue
backgroundColorCustom background color (ex: "#232323")Stringfalse"#fff"
textColorCustom text color (ex: "#00ff00")Stringfalse"#000"
radiusApply a radius on each squareNumberfalse0
classnamesApply your own CSS classStringfalse""
displayYearDisplay on each month (ex: 17/Avr)Booleanfalsefalse
onClickExecute a callback function when clicking on a square. Params: (data, index)Functionfalse{}
onMouseEnterExecute a callback function when mouse entering in a square. Params: (data, index)Functionfalse{}
onMouseLeaveExecute a callback function when mouse leaving a square. Params: (data, index)Functionfalse{}
shouldStartMondayUsually heatmap starts on Sunday but you can start it on MondayBooleanfalsefalse
monthSpaceChange space between month blocksNumberfalse0
rangeDisplayDataDisplay data between two dates. Tip: You can create an array of one or two dates Example: [new Date("2018-10-15T17:41:27"), new Date("2019-02-21T23:01:50")], [new Date("2019-02-21T23:01:50")], [null, new Date("2019-02-21T23:01:50")]Array[Date]false[]
fadeAnimationControl fade in animationObject{animate: Boolean, duration: Number (in second)}false{ animate: true, duration: 0.4 }

Author

Tom Darneix

License

MIT

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago