Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

benweizhu/react-heatmap.js

Repository files navigation

react-heatmap.js

A React Component based on heatmap.js.

yarn add react-heatmap.js
import React from 'react';
import ReactDom from 'react-dom';
import ReactHeatmap from 'react-heatmap.js';
class ReactHeatmapExample extends React.PureComponent {
 render() {
 const config = {
 radius: 10,
 maxOpacity: 0.5,
 minOpacity: 0,
 blur: 0.75
 };
 const points = [];
 const width = 840;
 const height = 400;
 let max = 0;
 let len = 300;
 while (len--) {
 const val = Math.floor(Math.random() * 100);
 // now also with custom radius
 const radius = Math.floor(Math.random() * 70);
 max = Math.max(max, val);
 const point = {
 x: Math.floor(Math.random() * width),
 y: Math.floor(Math.random() * height),
 value: val,
 // radius configuration on point basis
 radius
 };
 points.push(point);
 }
 return (
 <div style={{ width: '840px', height: '400px' }}>
 <ReactHeatmap configObject={config} max={max} data={points} />
 </div >
 );
 }
}
ReactDom.render(<ReactHeatmapExample />, document.querySelector('#app'));

For more configuration, take docs.html as reference.

About

A React Component based on heatmap.js.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /