@@ -9,33 +9,39 @@ import React from 'react';
99import ReactDom from ' react-dom' ;
1010import ReactHeatmap from ' react-heatmap' ;
1111
12- class ReactHeatmapExample extends React .Component {
12+ class ReactHeatmapExample extends React .PureComponent {
1313 render () {
14- var points = [];
15- var max = 0 ;
16- var width = 840 ;
17- var height = 400 ;
18- var len = 300 ;
14+ const config = {
15+ radius: 10 ,
16+ maxOpacity: 0.5 ,
17+ minOpacity: 0 ,
18+ blur: 0.75
19+ };
20+ const points = [];
21+ const width = 840 ;
22+ const height = 400 ;
23+ let max = 0 ;
24+ let len = 300 ;
1925
2026 while (len-- ) {
21- var val = Math .floor (Math .random () * 100 );
27+ const val = Math .floor (Math .random () * 100 );
2228 // now also with custom radius
23- var radius = Math .floor (Math .random () * 70 );
29+ const radius = Math .floor (Math .random () * 70 );
2430
2531 max = Math .max (max, val);
26- var point = {
32+ const point = {
2733 x: Math .floor (Math .random () * width),
2834 y: Math .floor (Math .random () * height),
2935 value: val,
3036 // radius configuration on point basis
31- radius: radius
37+ radius
3238 };
3339 points .push (point);
3440 }
3541
3642 return (
3743 < div style= {{ width: ' 840px' , height: ' 400px' }}>
38- < ReactHeatmap max = { max } data= { points } unit = " notPercent " / >
44+ < ReactHeatmap configObject = {config} max= {max } data= { points} / >
3945 < / div >
4046 );
4147 }
@@ -44,3 +50,6 @@ class ReactHeatmapExample extends React.Component {
4450ReactDom .render (< ReactHeatmapExample / > , document .querySelector (' #app' ));
4551
4652```
53+ For more configuration, take [ docs.html] [ 747485cf ] as reference.
54+
55+ [ 747485cf ] : https://www.patrick-wied.at/static/heatmapjs/docs.html " docs.html "
0 commit comments