Giter Club home page Giter Club logo

react-heatmap.js's Introduction

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.

react-heatmap.js's People

Contributors

benweizhu avatar

Stargazers

Max Makarov avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

danimadmolil

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.