A very simple port of heatmap.js
for React
. The idea behind this component is to be able to display a heatmap over any type of content (image, div, components ...).
Inspired by react-heatmap.
Live Demo: @sarpere/heatmapjs-react
yarn
yarn dev
Then open localhost:8000
in a browser.
npm i @sarpere/heatmapjs-react
yarn add @sarpere/heatmapjs-react
import { Heatmap } from "@sarpere/heatmapjs-react";
const App = () => {
const data = [{ x: 10, y: 15, value: 5}, { x: 50, y: 50, value: 2}, ...];
return (
<Heatmap max={5} data={data} />
)
}
Prop | Type | Default | Required | Description |
---|---|---|---|---|
max | int | 5 | Yes | Maximum value for intensity |
data | array | [] | Yes | Heatmap array of dots |
unit | string | decimal | No | Can be either percent or decimal . If percent, a x value like 26 is considered 26% of the container from the top left |
config | HeatmapConfig | { |
No | A Heatmap can be customized with the HeatmapConfig. More info on Heatmap.js configObject |