Skip to content

Commit 92f2286

Browse files
committed
change example
1 parent e0caa82 commit 92f2286

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

example/index.jsx

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
import React from 'react';
22
import ReactDom from 'react-dom';
3-
import PropTypes from 'prop-types';
43
import ReactHeatmap from 'react-heatmap';
54

65
class ReactHeatmapExample extends React.Component {
7-
render(){
6+
render() {
7+
var points = [];
8+
var max = 0;
9+
var width = 840;
10+
var height = 400;
11+
var len = 300;
12+
13+
while (len--) {
14+
var val = Math.floor(Math.random() * 100);
15+
// now also with custom radius
16+
var radius = Math.floor(Math.random() * 70);
17+
18+
max = Math.max(max, val);
19+
var point = {
20+
x: Math.floor(Math.random() * width),
21+
y: Math.floor(Math.random() * height),
22+
value: val,
23+
// radius configuration on point basis
24+
radius: radius
25+
};
26+
points.push(point);
27+
}
28+
829
return (
9-
<div><ReactHeatmap /></div>
30+
<div style={{ width: '840px', height: '400px' }}>
31+
< ReactHeatmap max= { max } data= { points } unit= "notPercent" />
32+
</div >
1033
);
1134
}
1235
}
1336

14-
ReactDom.render(<ReactHeatmapExample/>, document.querySelector('#app'));
37+
ReactDom.render(<ReactHeatmapExample />, document.querySelector('#app'));

example/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"webpack-dev-server": "^2.4.2"
2020
},
2121
"dependencies": {
22+
"heatmap.js": "^2.0.5",
2223
"prop-types": "^15.5.8",
2324
"react": "^15.5.4",
2425
"react-dom": "^15.5.4",

example/yarn.lock

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,10 +2645,12 @@ react-dom@^15.5.4:
26452645

26462646
"react-heatmap@https://github.com/benweizhu/react-heatmap.git":
26472647
version "1.0.0"
2648-
resolved "https://github.com/benweizhu/react-heatmap.git#0ce333cb85839ee514d3ac459e7f470627bd44ff"
2648+
resolved "https://github.com/benweizhu/react-heatmap.git#e0caa82f6604884820185f577fef1cc5cfc2cfea"
26492649
dependencies:
26502650
heatmap.js "^2.0.5"
2651-
prop-types "^15.5.7"
2651+
prop-types "^15.5.8"
2652+
react "^15.5.4"
2653+
react-dom "^15.5.4"
26522654

26532655
react@^15.5.4:
26542656
version "15.5.4"

0 commit comments

Comments
 (0)