HeatMap
A lightweight calendar heatmap react component built on SVG, customizable version of GitHub's contribution graph.
Install
Basic Usage
Basic usage example, Please pay warning to the time setting.
⚠️ Example: -> 2016-01-11
2016/01/11
, Support Safari
Set Color
Set the theme color style.
Set Rect Style
Set the radius of the rect.
Tooltip
A simple text popup tip.
Show/Hide Legend
Selected Rect
Props
Property | Description | Type | Default |
---|---|---|---|
value | Data to be displayed, required | Array | [] |
rectSize | Grid size | number | 11 |
legendCellSize | Size of the legend cells, in pixel. Value equal to 0 hide legend. |
number | 11 |
startDate | Start date | Date | new Date() |
endDate | End date | Date | - |
space | Interval between grid sizes | number | 2 |
rectProps | Grid node attribute settings | React.SVGProps<SVGRectElement> |
2 |
weekLables | Week display | string[] | ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] |
monthLables | Month display | string[] | ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] |
panelColors | Backgroud color of active colors | Record<number, string> |
{ 0: '#EBEDF0', 8: '#7BC96F', 4: '#C6E48B', 12: '#239A3B', 32: '#196127' } |
rectRender | Single day block re-render |
<E = SVGRectElement>(data: E & { key: number }, valueItem: HeatMapValue & { date: string, column: number, row: number, index: number }) => React.ReactElement |
- |
legendRender | Single legend block re-render |
(props: React.SVGProps<SVGRectElement>) => React.ReactNode |
- |
Development
development
Runs the project in development mode.
production
Builds the app for production to the build folder.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!