Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gl scatterplot #304

Closed
wants to merge 3 commits into from
Closed

Conversation

mcnuttandrew
Copy link
Contributor

gl-scatterplot

This is an initial pass at making use of deck.gl for a abstract vis rendering engine. This PR adds support for a new series type called MarkSeriesGL, what it's still missing is

  • Support for mouse events
  • Opacity finesse
  • Tests

Delighted to hear thoughts on this approach

@ibgreen
Copy link
Contributor

ibgreen commented Mar 21, 2017

@mcnuttandrew Very cool. Not sure if this is of interest, but an idea we have been playing with in deck.gl is to provide better React wrappers allowing deck.gl layers be specified as React components. The idea would be to allow the following type code that might make deck.gl easier to use for your purposes.

<DeckGL ...>
    <ScatterplotOverlay ...>
</DeckGL>

Perhaps implemented using something like:

class ScatterplotOverlay extends React.Component {
   constructor() {
      this.Layer = ScatterplotLayer;
   }
   render() { return null; }
}

class DeckGL extends React.Component {
  render() {
    let layers = [];
    React.children.forEach(child => {
      if (child.Layer) {
         layers.push(new child.Layer(child.props));
       }
     }
  }
}

Maybe an adaptation of this idea could be helpful in your integration?

@mcnuttandrew
Copy link
Contributor Author

@ibgreen That's a great idea! I feel like that would ease legibility lots of different places

Copy link
Contributor

@balthazar balthazar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

MarkSeries
} from 'index';

function getRandomData() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💅

const getRandomData = () =>
  new Array(100).fill(0).map(row => ({
    x: Math.random() * 10,
    y: Math.random() * 20,
    size: Math.random() * 10,
    color: Math.random() * 10,
    opacity: 0.9
  })
);

return (
<div className={`${predefinedClassName} ${className}`}>
{innerHeight && innerWidth && <DeckGL width={width} height={height} viewport={glViewport}
style={{position: 'absolute', top: '0px', left: '0px'}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

top: 0, left: 0

<div className={`${predefinedClassName} ${className}`}>
{innerHeight && innerWidth && <DeckGL width={width} height={height} viewport={glViewport}
style={{position: 'absolute', top: '0px', left: '0px'}}
layers={[this._renderScatterplotLayer(this.props)]}/>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why passing the props here? Juste get them from the method

@balthazar
Copy link
Contributor

balthazar commented Mar 21, 2017

Alternative implementation over ib comment

const DeckGL = ({children}) => 
  children.map(child => child.Layer && new child.Layer(child.props)).filter(l => l)

@mcnuttandrew mcnuttandrew deleted the gl-scatterplot branch March 23, 2017 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants