Skip to content

Commit 618561b

Browse files
committed
update readme
1 parent 5d6f743 commit 618561b

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1-
# react-heatmap
1+
# react-heatmap
2+
3+
A React Component based on [heatmap.js][b7fa289f].
4+
5+
[b7fa289f]: https://www.patrick-wied.at/static/heatmapjs/ "heatmap.js"
6+
7+
```
8+
import React from 'react';
9+
import ReactDom from 'react-dom';
10+
import ReactHeatmap from 'react-heatmap';
11+
12+
class ReactHeatmapExample extends React.Component {
13+
render() {
14+
var points = [];
15+
var max = 0;
16+
var width = 840;
17+
var height = 400;
18+
var len = 300;
19+
20+
while (len--) {
21+
var val = Math.floor(Math.random() * 100);
22+
// now also with custom radius
23+
var radius = Math.floor(Math.random() * 70);
24+
25+
max = Math.max(max, val);
26+
var point = {
27+
x: Math.floor(Math.random() * width),
28+
y: Math.floor(Math.random() * height),
29+
value: val,
30+
// radius configuration on point basis
31+
radius: radius
32+
};
33+
points.push(point);
34+
}
35+
36+
return (
37+
<div style={{ width: '840px', height: '400px' }}>
38+
< ReactHeatmap max= { max } data= { points } unit= "notPercent" />
39+
</div >
40+
);
41+
}
42+
}
43+
44+
ReactDom.render(<ReactHeatmapExample />, document.querySelector('#app'));
45+
46+
```

0 commit comments

Comments
 (0)