1.0.11 • Published 6 years ago

react-d3-hexbin v1.0.11

Weekly downloads
36
License
MIT
Repository
github
Last release
6 years ago

react-d3-hexbin

NPM

An easily customisable, responsive react hexbin plot component

Installation

npm i react-d3-hexbin --save or yarn add react-d3-hexbin

Usage

import React, { Component } from 'react';
import { randomNormal } from 'd3-random';
import { range } from 'd3-array';
import HexbinPlot from 'react-d3-hexbin';

class App extends Component {
  render() {
    const randomX = randomNormal(0, 1);
    const randomY = randomNormal(0, 1);
    const data = range(20000).map(() => [randomX(), randomY()] );
    return (
      <div className="App">
        <HexbinPlot points={ data }
                    width={ 600 }
                    height={ 600 }
                    radius={ 10 }
                    title={{
                      text: "Title",
                      font: 30,
                      color: '#ff1234',
                    }}
                    xLabel={{
                      text: "x-label",
                      font: 20,
                      color: '#000000',
                    }}
                    yLabel={{
                      text: "y-label",
                      font: 20,
                      color: '#000000',
                    }}
                    defaultColor="steelblue"
                    colorFilters={{
                      "red": (x, y) => y > x*x,
                      "green": (x, y) => y > 1/x,
                    }}/>
      </div>
    );
  }
}

export default App;

Required properties

  • points
  • width
  • height
  • radius
  • defaultColor

Optional properties

  • title
  • xLabel
  • yLabel
  • colorFilters
  • horizontalLines
  • verticalLines
  • grid
  • filter

Demo

https://react-d3-hexbin.firebaseapp.com/

To run demo on your own computer:

Authors

License

Copyright ©2017 Deargen Released under the MIT license.

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago