Skip to content

rnugraha/react-d3-interactome

 
 

Repository files navigation

react-d3-interactome

NPM JavaScript Style Guide

Pre-requisite

Install

yarn add react-d3-interactome

Usage

import React, { Component } from 'react'

import Interactome from 'react-d3-interactome'

class Example extends Component {
  componentDidMount() {
    const interactomeColorRange = scaleLinear()
    .domain([0, 1])
    .range([rgb('#eed841'), rgb('#551a8b')])
  
    const newColorScale = scaleLinear()
      .domain([0, 1])
      .range(interactomeColorRange.range())
        
    let options = {
      data: __options__,
      el: document.getElementById('containerEl'),
      colorScale: newColorScale
    }

    if (options) {
      InteractomePlot.create(options)
    }
  }

  render() {
    return (
      <div>
        <div id='containerEl' />
      </div>
    )
  }
}

Check the /example for more details.

Development

Local development is broken into two parts (ideally using two tabs). First, run rollup to watch your src/ module and automatically recompile it into dist/ whenever you make changes.

yarn start # runs rollup with watch flag

The second part will be running the example/ create-react-app that's linked to the local version of your module.

# (in another tab)
cd example
yarn start # runs create-react-app dev server

License

GPL-3.0-or-later © thehyve

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.8%
  • Other 1.2%